]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2014 Joel de Guzman | |
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 | #if !defined(BOOST_SPIRIT_X3_TUPLE_TRAITS_JANUARY_2012_1132PM) | |
8 | #define BOOST_SPIRIT_X3_TUPLE_TRAITS_JANUARY_2012_1132PM | |
9 | ||
10 | #include <boost/fusion/include/is_sequence.hpp> | |
11 | #include <boost/fusion/include/size.hpp> | |
12 | #include <boost/mpl/bool.hpp> | |
13 | #include <boost/mpl/and.hpp> | |
14 | ||
15 | namespace boost { namespace spirit { namespace x3 { namespace traits | |
16 | { | |
17 | template <typename A, typename B> | |
18 | struct has_same_size | |
19 | : mpl::bool_<( | |
20 | fusion::result_of::size<A>::value == | |
21 | fusion::result_of::size<B>::value | |
22 | )> | |
23 | {}; | |
24 | ||
25 | template <typename T, std::size_t N> | |
26 | struct has_size | |
27 | : mpl::bool_<(fusion::result_of::size<T>::value == N)> | |
28 | {}; | |
29 | ||
30 | template <typename A, typename B> | |
31 | struct is_same_size_sequence | |
32 | : mpl::and_< | |
33 | fusion::traits::is_sequence<A> | |
34 | , fusion::traits::is_sequence<B> | |
35 | , has_same_size<A, B> | |
36 | > | |
37 | {}; | |
38 | ||
39 | template <typename Seq> | |
40 | struct is_size_one_sequence | |
41 | : mpl::and_< | |
42 | fusion::traits::is_sequence<Seq> | |
43 | , has_size<Seq, 1> | |
44 | > | |
45 | {}; | |
46 | }}}} | |
47 | ||
48 | #endif |