1 Jun
2017
1 Jun
'17
6:52 p.m.
Robert Ramey wrote:
or
template<class T> struct outcome : public std::variant
{ // some special member functions outcome(const std::error_code & e){...} // construct as error outcome(const T & t){...} // construct legitimate result }; Something like this?
https://github.com/pdimov/variant2/blob/develop/include/boost/variant2/resul...
And here's outcome for comparison: https://github.com/pdimov/variant2/blob/develop/include/boost/variant2/outco... https://godbolt.org/g/I4gM8D The generated code does look a bit worse, the destructor is not optimized out.