I have the following code:
struct Node
{
int a;
int b;
};
Node node;
node.a = 2;
node.b = 3;
map aa;
aa[1]=1; // OK.
map
You have to tell std::map how to compare the Node objects. By default it tries to do so by using the less than operator. But you didn't provide any less than operator for Node. The easiest solution would be to supply one.
Free function example:
bool operator<(Node const& n1, Node const& n2)
{
return n1.a
Note that, for any pair of node objects x,y with !(x
!(y