Does anyone know how to create two multimap associative containers. The first one would have duplicate keys. Then i would like to post the algorithm to search for all duplicates and move them over to a second container and maybe delete the original duplicates in the first container.
i.e. :
typedef multimap< int, int, less< int > > mma;
mma contain1;
typedef multimap< int, less< int > > ne;
ne contain2;
cointain1.insert(mma::value_tpe(5, 2);
cointain1.insert(mma::value_tpe(5, 3);
cointain1.insert(mma::value_tpe(5, 3);
cointain1.insert(mma::value_tpe(6, 2);
any help would be much appreciated.
Read about
multi_map::lower_boundandmulti_map::upper_bound. They’ll give you a pair of iterators that define a sequence of values that are equal to the argument. If the length of the sequence is greater than 1, you’ve got duplicates.