Subject: Re: [boost] [optional] generates unnessesary code for trivial types
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-02-08 22:18:59
On Wednesday, February 08, 2012 19:05:26 Hite, Christopher wrote:
> Do we gurantee boost users that templates will never add default parameters?
This would be a breaking change, so yes, such a change should be avoided if
possible. Personnally, I didn't grasp the benefit of using these traits to
justify the breakage. What will be traits used for, what will it provide?
> > BTW, I would really like to see optional< T& > optimized to store T*
> > internally.
> I'm going to say something provacative here. I agree with Lucanus. I see no
> reason for optional<T&>. As far I can tell you could use a T*. The only
> justification I can think of is on system without memory protection you can
> build checks into operator*().
> Maybe I'm missing something, but I don't see the justification.
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. I'm going to use
this property in my Boost.Log library.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk