This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: deleting a value from multimap




mahadev wrote:
> 
> Hi all,
> 
> my requirement is to delete a "value" from a multimap regardless of the
> "key".
> For ex:
>    multimap<string, int> fruits;
>    fruits.insert(pair<string, int>("apple",1));
>    fruits.insert(pair<string, int>("apple",2));
> 
>    fruits.insert(pair<string, int>("cherry",1));
>    fruits.insert(pair<string, int>("cherry",3));
> 
> I want to delete the value "1"  whether the key ="apple" or "cherry".
> After deletion "apple" should have only "2" as its value;i.e i need to
> delete only the "value" and not the "key"
> 
> I tried "erase()", but even after erasing, i am able to print the values.
> 
> Thanks,
> Vasavi
> 
>     
> 

-- 
View this message in context: http://old.nabble.com/deleting-a-value-from-multimap-tp32894799p32895049.html
Sent from the gcc - libstdc++ mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]