]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/tutorial/constant_side_effects.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / tutorial / constant_side_effects.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/bool.hpp>
6
7 #include <iostream>
8 namespace hana = boost::hana;
9
10
11 namespace pure {
12 //! [pure]
13 template <typename X>
14 auto identity(X x) { return x; }
15
16 auto x = identity(hana::bool_c<true>);
17 static_assert(hana::value(x), "");
18 //! [pure]
19 }
20
21 namespace impure {
22 //! [impure_identity]
23 template <typename X>
24 auto identity(X x) {
25 std::cout << "Good luck in evaluating this at compile-time!";
26 return x;
27 }
28 //! [impure_identity]
29
30 //! [impure]
31 auto x = identity(hana::bool_c<true>);
32 static_assert(hana::value(x), "");
33 //! [impure]
34 }
35
36 int main() { }