Show the code in which you tried to "use the insert() function to insert things into the map, when it was just an instance and not a typedef".Quote:
Originally Posted by Programmer_P
Printable View
Show the code in which you tried to "use the insert() function to insert things into the map, when it was just an instance and not a typedef".Quote:
Originally Posted by Programmer_P
Show your code, please.
No need. It was a noobie mistake. :p I accidentally forgot to prefix the member function definition that assigns one map to another map to make a copy of the map, then returns the copy, with the class name followed by the "::" operator, which is why it was saying the map copy name didn't exist in the scope.
All good now.
Map::Insert is a far better choice even though it is syntactically more complex.Quote:
aMap[currentNum - 1] = aStringVector.at(currentNum - 1);
Depends on what you need. If you are just going to insert without regard as to whether it's there or not, then the index operator might do the job.
Any other reason it shouldn't be preferred?