
on Wed Jan 25 2012, "Simonson, Lucanus J" <lucanus.j.simonson-AT-intel.com> wrote:
I don't personally think that the style of programming that optional is intended for is suitable for high performance/performance critical situations in the first place.
Why not? It seems like a great candidate for common compiler optimizations.
Pass by reference and return a bool for a conditional return value. Pass the bool and the object separately for a conditional argument. Pass or return a pointer and check if it is null. Yes, my advice really is to not use optional if you want performance.
Why?
Even if we did everything you can think of to make optional fast you are still better off designing your interfaces in such a way that you don't need it if your goal is performance.
Why do you say that? -- Dave Abrahams BoostPro Computing http://www.boostpro.com