std::allocator is a template. You need to add like the following std::allocator<std::pair<const string, Field>>
:
class Clue {
public:
Clue() {std::cout << "Clue" << std::endl;}
};
class Field {
public:
Field() {std::cout << "Field" << std::endl;}
};
class S
{
public:
typedef map<string,
Field,std::less<string>,
std::allocator<std::pair<const string, Field>>
> tFieldsList;
typedef map<string,
Field,
std::less<string>,
std::allocator<std::pair<const string, Field>>
>::const_iterator cFieldsIter;
typedef map<string,
Field,
std::less<string>,
std::allocator<std::pair<const string, Field>>
>::iterator FieldsIter;
typedef vector<Clue,std::allocator<Clue>> tVectorClue;
};
Also, you have some typos like std::cout "Clue" << endl;
in your code, should be std::cout << "Clue" << std::endl;
However, you are doing too much work! You can change the code like this, since the third and fourth template parameter has default template arguments for std::map
and the second argument for std::vector
, so you don't need to provide:
typedef map<string,Field> tFieldsList;
typedef map<string ,Field>::const_iterator cFieldsIter;
typedef map<string ,Field>::iterator FieldsIter;
typedef vector<Clue> tVectorClue;