]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/optional/monad.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / optional / monad.cpp
1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/chain.hpp>
7 #include <boost/hana/config.hpp>
8 #include <boost/hana/equal.hpp>
9 #include <boost/hana/flatten.hpp>
10 #include <boost/hana/optional.hpp>
11 namespace hana = boost::hana;
12
13
14 int main() {
15 BOOST_HANA_CONSTEXPR_LAMBDA auto inc = [](auto x) {
16 return hana::just(x + 1);
17 };
18
19 BOOST_HANA_CONSTEXPR_CHECK(hana::chain(hana::just(1), inc) == hana::just(2));
20 BOOST_HANA_CONSTANT_CHECK(hana::chain(hana::nothing, inc) == hana::nothing);
21
22 BOOST_HANA_CONSTEXPR_CHECK(hana::flatten(hana::just(hana::just(2))) == hana::just(2));
23 }