
Sascha Krissler <boost-dev@k.datenfreihafen.de> writes:
Another solution would be to make a detail::generic_optional with all the operator foo and let optional inherit from it. That would be infinitesimal backward-incompatible ;)
I would use a simple metafunction to transform a type T into a type with a null value: template <class T> struct nullable { typedef boost::optional<T> type; }; template <class T> struct nullable<T*> { typedef T* type; }; // other specializations for types with built-in NULL values This way you're really not incurring any overhead for types that are already nullable. Use free functions to smooth out any messy interface differences due to the optional<T> wrapper on some types. HTH, Dave -- Dave Abrahams Boost Consulting www.boost-consulting.com