Boost logo

Boost Users :

Subject: [Boost-users] [MultiIndex] insert with and without position hint
From: Igor R (boost.lists_at_[hidden])
Date: 2009-11-23 14:07:26


Hello,

For some reason, the "hinted" version of insert() returns just an
iterator, while the "unhinted" one returns pair:
std::pair<iterator,bool> insert(const value_type& x);
iterator insert(iterator position,const value_type& x);

I've got a container with 1 ordered unique index. From one hand, I
have to know whether the insertion was succesful, but from the other
hand, 99% of the objects are inserted in their natural ascending
order, so I use the hinted version:
container_.insert(container_.end(), newObj);
So my question is whether there's any performance benefit of the
"hinted" version in such case, or I can move to the simple one w/o any
performance loss?

Thanks.


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