Haskell style “Maybe” type & *chaining* in C++11

前端 未结 5 1033
隐瞒了意图╮
隐瞒了意图╮ 2020-12-23 20:43

I repeatedly find myself requiring Haskell style Maybe (especially Maybe chaining) in my project at work. E.g. withdrawal request from customer and we are give

5条回答
  •  有刺的猬
    2020-12-23 21:26

    It's been implemented in C++03 for a long time. You can find it in Boost as boost::optional. boost::optional offers a simple if (value) interface.

提交回复
热议问题