Код: Выделить всё
#include
class test_class {
public:
template
class inner_class {
private:
T value;
public:
inner_class() : value(T()) {}
bool operator==(const inner_class& other) const {
return value == other.value;
}
};
inner_class _int64; // Error here
};
int main() {
test_class t;
return 0;
}
Код: Выделить всё
cl.exe /std:c++17 /EHsc /W4 test.cpp
Код: Выделить всё
error C2628: 'test_class::inner_class' followed by '__int64' is illegal (did you forget a ';'?)
error C2208: 'test_class::inner_class': no members defined using this type
Версия Visual Studio:
Код: Выделить всё
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30156 for x64
- Использование явного пространства имен std:::
Код: Выделить всё
inner_class _int64;
- Использование псевдонимов типов:
Код: Выделить всё
using int64_type = std::int64_t;
inner_class _int64;
- Добавление ключевого слова typename:
Код: Выделить всё
inner_class _int64;
Подробнее здесь: https://stackoverflow.com/questions/791 ... is-illegal