]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_assoc_struct.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_ASSOC_TPL_STRUCT((M), BOOST_PP_EMPTY(), 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> >)); | |
92f5a8d4 | 33 | BOOST_STATIC_ASSERT(!traits::is_view<empty_struct<void> >::value); |
7c673cae FG |
34 | empty_struct<void> e; |
35 | ||
36 | std::cout << e << std::endl; | |
37 | BOOST_TEST(e == make_vector()); | |
38 | ||
39 | BOOST_STATIC_ASSERT(fusion::result_of::size<empty_struct<void> >::value == 0); | |
40 | BOOST_STATIC_ASSERT(fusion::result_of::empty<empty_struct<void> >::value); | |
41 | } | |
42 | ||
43 | { | |
44 | vector<> v; | |
45 | empty_struct<void> e; | |
46 | BOOST_TEST(v == e); | |
47 | BOOST_TEST_NOT(v != e); | |
48 | BOOST_TEST_NOT(v < e); | |
49 | BOOST_TEST(v <= e); | |
50 | BOOST_TEST_NOT(v > e); | |
51 | BOOST_TEST(v >= e); | |
52 | } | |
53 | ||
54 | { | |
55 | empty_struct<void> e; | |
56 | ||
57 | // conversion from empty_struct to vector | |
58 | vector<> v(e); | |
59 | v = e; | |
60 | ||
61 | // conversion from empty_struct to list | |
62 | //list<> l(e); | |
63 | //l = e; | |
64 | } | |
65 | ||
66 | { // begin/end | |
67 | typedef fusion::result_of::begin<empty_struct<void> >::type b; | |
68 | typedef fusion::result_of::end<empty_struct<void> >::type e; | |
69 | ||
70 | BOOST_MPL_ASSERT((fusion::result_of::equal_to<b, e>)); | |
71 | } | |
72 | ||
73 | BOOST_MPL_ASSERT((mpl::is_sequence<empty_struct<void> >)); | |
74 | BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct<void>, void>)); | |
75 | BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key<empty_struct<void>, int>)); | |
76 | ||
77 | return boost::report_errors(); | |
78 | } |