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".Originally Posted by Programmer_P
This is a discussion on Map member of class produces error - why? within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by Programmer_P And yet it would not let me use the insert() function to insert things into the ...
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".Originally Posted by Programmer_P
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
I'm an alien from another world. Planet Earth is only my vacation home, and I'm not liking it.
Show your code, please.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
No need. It was a noobie mistake.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.
I'm an alien from another world. Planet Earth is only my vacation home, and I'm not liking it.
Map::Insert is a far better choice even though it is syntactically more complex.aMap[currentNum - 1] = aStringVector.at(currentNum - 1);
Arrogance breeds bad code
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?
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^