Closed viboes closed 10 years ago
What get() does? Do you mean value()? unwrap takes in account the state of two nested expected.
Next follows the definition using a non-member function
template <class T, class E>
expected<E,T> unwrap(expected<E, expected<E,T> > ee) {
if (ee) return *ee;
return ee.get_unexpected();
}
template <class T, class E>
expected<E,T> unwrap(expected<E,T> e) {
return e;
}
Ok, I think it makes sense, I'm adding this and redefined mbind in term of fmap.
I suggest to change the title of this issue to Add unwrap member function and make it an enhancement.
What would be the difference between unwrap and get or operator*?