Boost logo

Boost :

From: Joe Gottman (jgottman_at_[hidden])
Date: 2004-03-30 19:30:00


"Joaquín Mª López Muñoz" <joaquin_at_[hidden]> wrote in message
news:4069B0EE.598AA848_at_tid.es...

>Pavel Vozenilek ha escrito:
>
>> "JOAQUIN LOPEZ MU?Z" <joaquin_at_[hidden]> wrote
>>
>> > std::set<int> s;
>> > ...
>> > boost::optional<int> oi=s.insert(10);
>> > // oi is initialized iff insertion took place.
>> >
>> set::insert returns pair of iterator + bool.
>>
>
>You're right. I meant optional<iterator>.

   Also, the iterator produced by set::insert is always meaningful. If the
insertion is successful then the iterator points to the just-inserted
element, and the bool equals true. If the insertion is not successful then
the iterator points to the element of the set that caused the insertion to
fail, and the bool equals false.

Joe Gottman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk