Reputation: 1606
I'm trying to do the following:
struct Code
{
GF2X generator;
vector<GF2X> codeWords;
};
vector<Code> allCodes;
However, I end up with this error:
error: template argument for 'template<class _Alloc> class std::allocator' uses local type 'main()::Code'|
I'm completely lost as to what this means. This is also my first time programming in C++.
Upvotes: 1
Views: 242
Reputation: 208353
In C++03 local classes (classes defined inside a function) cannot be used as template arguments. That restriction was lifted in C++11, but if your compiler does not have support for this feature you can always move the type definition outside of the function at namespace level.
Upvotes: 5
Reputation: 3119
You haven't posted all your code, but I'm guessing that you put struct Code ...
inside your main function. Try moving it above the start of main.
Upvotes: 0