Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
maps and constructors
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Hicham Mouline, post: 3406760"] my mistake. The const was my mistaken attempt to change the elements of the pair, ie. to make the 2nd line of code M[5.0] = std::pair<a1, b1>; M[5.0].first = a2; impossible My point is to store the pairs in the map once, and then never change them at a later stage. The choice between std::map<double, std::pair<A, B> > and std::map<double, const std::pair<A, B>* >: With a million entries in the map, and if the pairs already exist elsewhere, the non-ptr-version of the map would copy those pairs, while the ptr version would store only a ptr to each pair. Here i assume sizeof( const std::pair<A, B>* ) < sizeof( std::pair<A, B> ) [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
maps and constructors
Top