Ошибка компиляции в std::is_same_v при использовании типа, вложенного в класс, который содержит функцию-член с тем же имC++

Программы на C++. Форум разработчиков
Anonymous
Ошибка компиляции в std::is_same_v при использовании типа, вложенного в класс, который содержит функцию-член с тем же им

Сообщение Anonymous »

Это не дубликат функции и структуры с одинаковым именем в c++
Приведенный ниже код завершается с ошибкой:

Код: Выделить всё

error C2923: 'std::is_same_v': 'A::B' is not a valid template type argument for parameter ''

Код: Выделить всё

#include 

//Primary template
template struct ClassOf {
};

// Partial specialisation
template
struct ClassOf {
using type = Class;};

//An alias
template< typename T> using ClassOf_t = typename ClassOf::type;

struct A {
struct B {
void methodB () {}

};
B* myPtr;
// Rename the function to BB() and do this as well on L29 and the code will compile
B* B() { return myPtr; }    // 

Подробнее здесь: [url]https://stackoverflow.com/questions/78651000/compile-error-in-stdis-same-v-when-using-a-type-nested-in-a-class-that-contain[/url]

Вернуться в «C++»