----- Original Message ----- From: "David Abrahams" <[EMAIL PROTECTED]> To: "Boost mailing list" <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 12:46 PM Subject: Re: [boost] Formal review: Optional library
> "Fernando Cacciola" <[EMAIL PROTECTED]> writes: > > Why do you think aligned_storage<T> will be any less-efficient than T > when T is a POD? > > > If you still don't see it I can show you the typical machine > > generated code for both implementations for operator*(). > > I'm not surprised the non-POD version is slower as long as you're > storing a separate pointer. If you use the static_cast form I show > above, there's no reason for it to be any worse, AFAICT. > Well, I actually changed the implementation of pointer_based_optional<> to use the static_cast<> directy from the aligned_storage, and beyond any doubts, it is **exactly** as efficient as the value-based implementation, just like you (and Joel) said. In fact, after some thinking it was clear that the extra pointer data member was introducing an additional !unnecesary! indirection. Thus, the POD optimization was just needed becasue the NonPOD implementation was plain wrong :-) There is no need for two implementations any more! Thanks Joel and David! Fernando Cacciola _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost