Boost logo

Boost Users :

Subject: Re: [Boost-users] Question on boost multi-index container erase method
From: joaquin_at_[hidden]
Date: 2008-10-09 02:00:00


Ramesh escribió:
> Apologies for a late response, i was on travel.
>
> Thank you very much. Works perfectly. I checked the prototype for
> erase - it returns a count of objects that it erases, in my case -
> after I made the code change as you suggested, compiler flagged an
> error saying couldnt convert iterator to size_t type.
>
> error: cannot convert
> 'boost::multi_index::detail::index_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<<MyMap>>
>
>>> ' to 'size_t' in initialization
>>>
>
> Is the datatype of status wrong?
>

Oh, yes, it is wrong, I overlooked that on my previous post.
erase(iterator) does not
return a count of erased elements but an iterator to the element
following the one that
was erased. It is erase(const key_type&) that returns a count. This is
documented
at http://tinyurl.com/3k728t and mimics the interface of STL associative
containers.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net