B
Bryan Pietrzak
I'm new to using the STL and templates and while I've had no problem
at all using vector, I'm having a problem using map.
I just want to do something like:
class CMyData
{
// class stuff here
};
typedef map<string, CMyData &> MyDataMap;
MyDataMap datamap;
datamap.insert(MyDataMap::value_type("some key", someDataReference));
But it won't compile. I have no problem using maps with the key and
data being built-in or STL types, but not with my own types.
I'm clearly missing something here, and I suspect it's related to the
compare function, but I'm really not sure what I'm supposed to be
doing.
Googling has not been very helpful, nor is the STL book I have as it
sticks to the well known types.
A little nudge in the right direction is all I'm looking for here...
Bryan
at all using vector, I'm having a problem using map.
I just want to do something like:
class CMyData
{
// class stuff here
};
typedef map<string, CMyData &> MyDataMap;
MyDataMap datamap;
datamap.insert(MyDataMap::value_type("some key", someDataReference));
But it won't compile. I have no problem using maps with the key and
data being built-in or STL types, but not with my own types.
I'm clearly missing something here, and I suspect it's related to the
compare function, but I'm really not sure what I'm supposed to be
doing.
Googling has not been very helpful, nor is the STL book I have as it
sticks to the well known types.
A little nudge in the right direction is all I'm looking for here...
Bryan