|
Boost : |
Subject: Re: [boost] [optional] generates unnessesary code for trivial types
From: Hite, Christopher (Christopher.Hite_at_[hidden])
Date: 2012-02-10 10:16:49
From: Domagoj Saric <domagoj.saric_at_[hidden]>
> > Maybe I'm missing something, but I don't see the justification.
> IMO it seems that, yes, you are making the same mistake as Lucanus, thinking
> about "The Universe" only as/through your POV of your personal problem domain:
> a) (optional models optionally holding an object) + (objects can be held by
> value and by reference) = optional<T&> perfectly logical
I'm really not. Give me a use case. Do they make sense being passed as
parameters/returns? Do they make sense being stored?
I just see some corner case of optional being turned into a replacement for regular
pointer.
Why not just make dumb_ptr<T>? If you want you can make it streamable and
give it clean construction.
What is it you really want from optional<T&>? Does anyone use it a lot?
Is it like std::vector<bool>?
> b) creating special cases (e.g. for T&) creates special problems in generic code
My point exactly. I'd make it work for completeness but not bother to optimize.
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk