• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2014 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 #include <boost/config.hpp>
8 #include <boost/fusion/container/vector.hpp>
9 #include <boost/fusion/container/deque.hpp>
10 #include <boost/fusion/container/list.hpp>
11 #include <boost/fusion/container/set.hpp>
12 #include <boost/fusion/container/map.hpp>
13 #include <boost/fusion/support/pair.hpp>
14 #include <boost/fusion/sequence/intrinsic/size.hpp>
15 #include <boost/type_traits/is_same.hpp>
16 #include <boost/mpl/assert.hpp>
17 
18 #include <boost/array.hpp>
19 #include <boost/fusion/adapted/boost_array.hpp>
20 #include <boost/tuple/tuple.hpp>
21 #include <boost/fusion/adapted/boost_tuple.hpp>
22 #if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \
23     !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
24 #include <tuple>
25 #include <boost/fusion/adapted/std_tuple.hpp>
26 #endif
27 
28 template <typename LHS, typename RHS>
check_(LHS const &,RHS const &)29 void check_(LHS const&, RHS const&)
30 {
31     BOOST_MPL_ASSERT((boost::is_same<LHS, RHS>));
32 }
33 
34 template <typename S>
check()35 void check()
36 {
37     check_(
38         boost::fusion::result_of::size<S>::type::value
39       , boost::fusion::result_of::size<S>::value
40     );
41 }
42 
test()43 void test()
44 {
45     {
46         check<boost::fusion::vector<> >();
47         check<boost::fusion::vector<int> >();
48         check<boost::fusion::vector<int, int> >();
49         check<boost::fusion::vector<int, int, int> >();
50     }
51 
52     {
53         check<boost::fusion::deque<> >();
54         check<boost::fusion::deque<int> >();
55         check<boost::fusion::deque<int, int> >();
56         check<boost::fusion::deque<int, int, int> >();
57     }
58 
59     {
60         check<boost::fusion::list<> >();
61         check<boost::fusion::list<int> >();
62         check<boost::fusion::list<int, int> >();
63         check<boost::fusion::list<int, int, int> >();
64     }
65 
66     {
67         check<boost::fusion::set<> >();
68         check<boost::fusion::set<int> >();
69         check<boost::fusion::set<int, float> >();
70         check<boost::fusion::set<int, float, double> >();
71     }
72 
73     {
74         check<boost::fusion::map<> >();
75         check<boost::fusion::map<boost::fusion::pair<int, int> > >();
76         check<boost::fusion::map<boost::fusion::pair<int, int> , boost::fusion::pair<float, int> > >();
77         check<boost::fusion::map<boost::fusion::pair<int, int> , boost::fusion::pair<float, int> , boost::fusion::pair<double, int> > >();
78     }
79 
80     {
81         check<boost::array<int, 1> >();
82         check<boost::array<int, 2> >();
83         check<boost::array<int, 3> >();
84     }
85 
86     {
87         check<boost::tuples::tuple<> >();
88         check<boost::tuples::tuple<int> >();
89         check<boost::tuples::tuple<int, int> >();
90         check<boost::tuples::tuple<int, int, int> >();
91     }
92 
93 #if !defined(BOOST_NO_CXX11_HDR_TUPLE) && \
94     !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
95     {
96         check<std::tuple<> >();
97         check<std::tuple<int> >();
98         check<std::tuple<int, int> >();
99         check<std::tuple<int, int, int> >();
100     }
101 #endif
102 }
103 
104