]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/transform.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)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/equal.hpp>
7 #include <boost/hana/optional.hpp>
8 #include <boost/hana/transform.hpp>
9 #include <boost/hana/tuple.hpp>
10 #include <boost/hana/type.hpp>
14 #include <type_traits>
15 namespace hana
= boost::hana
;
16 using namespace std::literals
;
19 auto to_string
= [](auto x
) {
20 std::ostringstream ss
;
26 BOOST_HANA_RUNTIME_CHECK(
27 hana::transform(hana::make_tuple(1, '2', "345", std::string
{"67"}), to_string
)
29 hana::make_tuple("1", "2", "345", "67")
32 BOOST_HANA_CONSTANT_CHECK(hana::transform(hana::nothing
, to_string
) == hana::nothing
);
33 BOOST_HANA_RUNTIME_CHECK(hana::transform(hana::just(123), to_string
) == hana::just("123"s
));
35 BOOST_HANA_CONSTANT_CHECK(
36 hana::transform(hana::tuple_t
<void, int(), char[10]>, hana::template_
<std::add_pointer_t
>)
38 hana::tuple_t
<void*, int(*)(), char(*)[10]>