]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/core/convert/to.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / core / convert / to.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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/config.hpp>
7#include <boost/hana/core/to.hpp>
8#include <boost/hana/equal.hpp>
9#include <boost/hana/tuple.hpp>
10namespace hana = boost::hana;
11
12
13template <typename X, typename Y, typename Z>
14struct Triple {
15 X first;
16 Y second;
17 Z third;
18};
19
20BOOST_HANA_CONSTEXPR_LAMBDA auto triple = [](auto x, auto y, auto z) {
21 return Triple<decltype(x), decltype(y), decltype(z)>{x, y, z};
22};
23
24namespace boost { namespace hana {
25 template <typename X, typename Y, typename Z>
26 struct to_impl<tuple_tag, Triple<X, Y, Z>> {
27 static constexpr auto apply(Triple<X, Y, Z> xs) {
28 return make_tuple(xs.first, xs.second, xs.third);
29 }
30 };
31}}
32
33int main() {
34 BOOST_HANA_CONSTEXPR_CHECK(
35 hana::to<hana::tuple_tag>(triple(1, '2', 3.3)) == hana::make_tuple(1, '2', 3.3)
36 );
37}