|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-03-29 16:35:59
JOAQUIN LOPEZ MU?Z wrote:
> ----- Mensaje original -----
> De: Shannon Stewman <stew_at_[hidden]>
> Fecha: Lunes, Marzo 29, 2004 10:33 pm
> Asunto: Re: [boost] Index_set observations
>
>> On Mon, Mar 29, 2004 at 08:14:09AM +0200, Joaqu?n M? L?pez Mu?oz
>> wrote:
>>> If the insertion violates some constraint, then it does
>>> not take place. insert operations return a
>>> pair<iterator,bool>: the bool indicates whether insertion
>>> succeeded or not.
>>
>> Forgive me if this has already been asked, but why don't you
>> return a
>> boost::optional<> object?
>>
>
> It has not been asked before. The only reason is
> that this is how STL containers (like std::set) do
> it.
STL containers return pair<iterator, bool>, because the iterator return is
not optional, it's always valid and useful. optional<iterator> is not the
same as pair<iterator, bool>.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk