Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / test / ext / boost / mpl / vector / to.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/ext/boost/mpl/vector.hpp>
6
7 #include <boost/hana/assert.hpp>
8 #include <boost/hana/core/to.hpp>
9 #include <boost/hana/equal.hpp>
10 #include <boost/hana/type.hpp>
11
12 #include <support/seq.hpp>
13
14 #include <boost/mpl/vector.hpp>
15 namespace hana = boost::hana;
16 namespace mpl = boost::mpl;
17
18
19 struct t1; struct t2; struct t3; struct t4;
20
21 int main() {
22     // Conversion from any `Foldable` containing `type`s
23     auto foldable = ::seq;
24     auto to_vector = hana::to<hana::ext::boost::mpl::vector_tag>;
25     BOOST_HANA_CONSTANT_CHECK(hana::equal(
26         to_vector(foldable()),
27         mpl::vector<>{}
28     ));
29
30     BOOST_HANA_CONSTANT_CHECK(hana::equal(
31         to_vector(foldable(hana::type_c<t1>)),
32         mpl::vector<t1>{}
33     ));
34
35     BOOST_HANA_CONSTANT_CHECK(hana::equal(
36         to_vector(foldable(hana::type_c<t1>, hana::type_c<t2>)),
37         mpl::vector<t1, t2>{}
38     ));
39
40     BOOST_HANA_CONSTANT_CHECK(hana::equal(
41         to_vector(foldable(hana::type_c<t1>, hana::type_c<t2>, hana::type_c<t3>)),
42         mpl::vector<t1, t2, t3>{}
43     ));
44
45     BOOST_HANA_CONSTANT_CHECK(hana::equal(
46         to_vector(foldable(hana::type_c<t1>, hana::type_c<t2>, hana::type_c<t3>, hana::type_c<t4>)),
47         mpl::vector<t1, t2, t3, t4>{}
48     ));
49 }