|
Boost : |
Subject: Re: [boost] [optional] generates unnessesary code for trivial types
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2012-01-27 13:57:30
> I see no reason why we can't have safe _and_ fast _and_ optional?
I'm actually glad to see you putting effort into making that happen. The effort required is the only reason. Performance wasn't the reason I don't use optional, but for those who do use it I'm sure it will be valuable.
>The rationale you gave is just typical premature pessimization apologetics that
>also somehow assumes that C++ is "safe and slow" and that you have to go "bare
>metal C" to have performance. Luckily that's just plain incorrect, to put it
>mildly. Sadly, that rationale nonetheless also too often gives us such bloatware
>as std::streams, lexical_cast or boost::filesystem...
I said safe and fast C++ without optional, which isn't the same thing as "bare metal C". Bare metal C wouldn't qualify as safe. I'm as annoyed by the "C is faster than C++, ergo I never learned C++" guys as you are. Optional was implemented to be safe and slow because it was targeting safe and slow use cases. For POD types and anything that has a default constructor a std::pair<bool, T> seems fine to me.
Regards,
Luke
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk