问题
Does anyone know of a good monad template library in C++. Perhaps, one that provides some of the common monads that you would see in Haskell like Maybe.
回答1:
You may want to check out the "monad.h" header in FC++. You can read more about this in the "Monads" part of this page: http://people.cs.umass.edu/~yannis/fc++/New1.5/lambda.html#monad
However, this may not be suited to actual industrial use -- it's still a nice exercise to implement and use them in C++ though.
回答2:
Something like Maybe can be found in Boost.Optional.
来源:https://stackoverflow.com/questions/5448162/c-monad-library