Boost logo

Boost :

Subject: Re: [boost] [optional] generates unnessesary code for trivial types
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2012-02-09 04:24:54


Den 09-02-2012 09:59, Nevin Liber skrev:
> On 8 February 2012 17:18, Andrey Semashev<andrey.semashev_at_[hidden]> wrote:
>> optional< T& > is a useful thing when you want to apply operators (such as
>> relation operators or streaming) to the referred value. In generic code you
>> don't have to specialize for pointers to do the right thing.
>
> +1 here. Please keep the interfaces the same, unless you have a
> *very* compelling reason not to.

+1.

optional<T*> cannot optimize the bool away, because it can be null. So
optional<T&> is both more efficeint and more handy.

-Thorsten


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