either monad

This is the C++ template metaprogramming equivalent of Haskell's Either monad. The purpose of this monad is to provide basic error handling for pure code. The either monad is similar to the exception monad, but it is more difficult to use because of treating every non-exception value as a result instead of introducing a new type, left for it. Compile-time exception handling is built on top of the exception monad.

Monadic values consist of left<T> and right<T>, where T is a nullary metafunction. Both left and right evaluate its argument. left represents error, right represents normal result.

General information