Boost logo

Boost :

Subject: Re: [boost] std::map::find() wrapper
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-05-03 15:52:55

On Tue, May 3, 2011 at 6:57 PM, Robert Jones <robertgbjones_at_[hidden]> wrote:
>  I'd prefer to see it return a boost::optional<T&>

What's the benefit?

> For containers of pointers to objects, the wrapper could do an
>> additional dereference.
> Not a good idea, it's easier to compose than decompose so return a
> boost::optional<T*&> and the user deref if they want to.

What problem would that avoid?
It'd require the user to do an additional check.


Boost list run by bdawes at, gregod at, cpdaniel at, john at