I have std::list< std::pair<std::string,double> > , which, as I know, is sorted according to std::string element .
Since I would like to do a lot of std::find_if based on the std::string element, I believe that std::map<string,double,MyOwnBinaryPredicate> with lower_bound and upper_bound would be more adequate.
The thing is, I want to insert elements in std::map efficient way. Therefore, I want to use an additional iterator to make insert faster.
I believe the easiest way is to use const_reverse_iterator to go through std::list and use begin() std::map .
Would you do it like this, or is it a bad idea?
Thanks!
c ++ insert std-pair stdlist stdmap
Wok
source share