Returning a pointer actually only superficially looks like you are protecting yourself from the narrow contract. You just force the caller to use narrow contract function on the pointer. This reminds me that at some point people here in Boost discussed that get<T>() accessor on variant
should return optional .
What the C++ 17 standard eventually did was to add a std::get_if<I>(&variant) which returns a pointer to the value if the variant is in that state. std::get<I>(variant) throws an exception if you don't use the right state. I guess, ultimately, the question to be answered here is how much like std::variant<...> should Outcome and/or Expected be? std::variant<...> doesn't implement completely unchecked observers like optional's operator*(), the best you can get is a nulled pointer observer, no silent reinterpret_cast. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/