
27 Oct
2009
27 Oct
'09
2:45 p.m.
2009/10/27 Stefan Strasser <strasser@uni-bremen.de>:
boost::optional<error_code&>? optional does have implicit conversion and the rest of your public interface.
Ah, good. I hoped it did, but I got confused by the Optional References page in the docs.
optional<T &> is implemented as a container of T & plus a bool though, but I see no reason not to create a boost::optional specialization that implements optional<T &> by holding a pointer that's exposed as a reference in the interface.
Which I suppose brings us right back to the question of whether null references are legal, since that (worthwhile) optimization is only valid if they're illegal.