#include <iostream>
#include <vector>
int main()
{
class Int {
public:
Int(int _i) : i(i) {}
private:
int i;
};
std::vector<Int> VI;
}
Я пытаюсь скомпилировать вышеуказанный код и получил следующее сообщение об ошибке:
foo.cc: In function 'int main()':
foo.cc:13: error: 'main()::Int' uses local type 'main()::Int'
foo.cc:13: error: trying to instantiate 'template<class _Alloc> class std::allocator'
foo.cc:13: error: template argument 2 is invalid
foo.cc:13: error: invalid type in declaration before ';' token
Может ли кто-нибудь из вас рассказать мне, почему я не могу делать подобные вещи на С++? Спасибо заранее.