Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

STL map

Hello,

class AAAA
{
private:
int number1;
int number2;

public:
AAAA() {}
virtual ~AAAA() {}
void setNumbers(int num1, int num2)
{
number1 = num1;
number2 = num2;
}
} myClass[3];

map<string, AAAA> myMap;
lv_key = "key0";
myMap[lv_key].setNumbers(7,3);

Is there a way to access setNumbers() ? I managed to compile map<string, AAAA> *myMapAAAA; but no sure how to write the equivalent of myMap[lv_key].setNumbers(7,3); using the pointer.
Can someone please help ?
[568 byte] By [ami] at [2007-11-11 9:58:19]
# 1 Re: STL map
map<string, AAAA> myMap;
lv_key = "key0";
myMap[lv_key]=AAAA().setNumbers(7,3);

This should work,but I haven't tested it.
Danny at 2007-11-11 20:59:42 >