]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/test/sequence/define_assoc_struct_empty.cpp
1 /*=============================================================================
2 Copyright (c) 2016 Kohei Takahashi
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 ==============================================================================*/
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>
19 BOOST_FUSION_DEFINE_ASSOC_STRUCT(BOOST_PP_EMPTY(), empty_struct
, )
24 using namespace boost
;
25 using namespace boost::fusion
;
27 std::cout
<< tuple_open('[');
28 std::cout
<< tuple_close(']');
29 std::cout
<< tuple_delimiter(", ");
32 BOOST_MPL_ASSERT_NOT((traits::is_view
<empty_struct
>));
35 std::cout
<< e
<< std::endl
;
36 BOOST_TEST(e
== make_vector());
38 BOOST_STATIC_ASSERT(fusion::result_of::size
<empty_struct
>::value
== 0);
39 BOOST_STATIC_ASSERT(fusion::result_of::empty
<empty_struct
>::value
);
46 BOOST_TEST_NOT(v
!= e
);
47 BOOST_TEST_NOT(v
< e
);
49 BOOST_TEST_NOT(v
> e
);
56 // conversion from empty_struct to vector
60 // conversion from empty_struct to list
66 typedef fusion::result_of::begin
<empty_struct
>::type b
;
67 typedef fusion::result_of::end
<empty_struct
>::type e
;
69 BOOST_MPL_ASSERT((fusion::result_of::equal_to
<b
, e
>));
72 BOOST_MPL_ASSERT((mpl::is_sequence
<empty_struct
>));
73 BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key
<empty_struct
, void>));
74 BOOST_MPL_ASSERT_NOT((fusion::result_of::has_key
<empty_struct
, int>));
76 return boost::report_errors();