Emulation of DO syntax sugar for monads in C++