]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/test/sequence/define_tpl_struct_inline_empty.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / fusion / test / sequence / define_tpl_struct_inline_empty.cpp
1 /*=============================================================================
2 Copyright (c) 2016 Kohei Takahashi
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7
8 #include <boost/detail/lightweight_test.hpp>
9 #include <boost/fusion/container.hpp>
10 #include <boost/fusion/sequence.hpp>
11 #include <boost/fusion/sequence/io/out.hpp>
12 #include <boost/fusion/iterator/equal_to.hpp>
13 #include <boost/fusion/adapted/struct/define_struct_inline.hpp>
14 #include <boost/mpl/assert.hpp>
15 #include <boost/mpl/is_sequence.hpp>
16 #include <boost/static_assert.hpp>
17 #include <iostream>
18
19 BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), empty_struct, )
20
21 int
22 main()
23 {
24 using namespace boost;
25 using namespace boost::fusion;
26
27 std::cout << tuple_open('[');
28 std::cout << tuple_close(']');
29 std::cout << tuple_delimiter(", ");
30
31 {
32 BOOST_MPL_ASSERT_NOT((traits::is_view<empty_struct<void> >));
33 empty_struct<void> e;
34
35 std::cout << e << std::endl;
36 BOOST_TEST(e == make_vector());
37
38 BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct<void> >::value == 0);
39 BOOST_STATIC_ASSERT(fusion::result_of::empty<empty_struct<void> >::value);
40 }
41
42 {
43 vector<> v;
44 empty_struct<void> e;
45 BOOST_TEST(v == e);
46 BOOST_TEST_NOT(v != e);
47 BOOST_TEST_NOT(v < e);
48 BOOST_TEST(v <= e);
49 BOOST_TEST_NOT(v > e);
50 BOOST_TEST(v >= e);
51 }
52
53 {
54 empty_struct<void> e;
55
56 // conversion from empty_struct to vector
57 vector<> v(e);
58 v = e;
59
60 // conversion from empty_struct to list
61 //list<> l(e);
62 //l = e;
63 }
64
65 { // begin/end
66 typedef fusion::result_of::begin<empty_struct<void> >::type b;
67 typedef fusion::result_of::end<empty_struct<void> >::type e;
68
69 BOOST_MPL_ASSERT((fusion::result_of::equal_to<b, e>));
70 }
71
72 BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct<void> >));
73
74 return boost::report_errors();
75 }