On Fri, Jun 21, 2013 at 12:35 PM, David Sankel
**semantics**:
template< typename left_type, typename right_type> struct either { // postcondition, is_left() either( left_type );
// postcondition, is_right() either( right_type );
bool is_left() const; bool is_right() const;
// postcondition, is_left() either & operator=( left_type );
// postcondition, is_right() either & operator=( right_type );
// precondition, is_left() left_type left();
// precondition, is_right() right_type right(); private: };
**uses**:
**Use 1**: Can be used as an alternative to exceptions or the (error codes+set reference idiom):
There was also talk of an 'expected' class for this case (where one of the 2 choices was the, well, expected one). I'm still hoping for that class. Although it may be syntactically the same as 'either', I appreciate its explicit intentions. I'm not sure if that makes 'either' less needed, and means variant + expected ( + optional, etc) is enough. Tony