I think optional might be perfect for an issue I have, but there is one catch. I have a polymorphic hierarchy that I would like to use with optional, but optional<Base> is not a base of optional<Derived>. Of course, this isn't really a problem with optional, par se, but any suggestions on how to store pointers to optional<T> when T is polymorphic would be appreciated.
I know I can use aggregation like so: class Base { virtual ~Base() { } }; template <typename T> class PolyOptional : public Base { optional<T> value_; }; and then just store Base*, but this requires explicit run-time checking of types which would otherwise be automatic with pointers to T instead of optional<T>. If this is the only solution, so be it; but any clever alternatives are welcome. Dave _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost