1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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(FUSION_SIZE_05052005_0214)
8 #define FUSION_SIZE_05052005_0214
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/utility/enable_if.hpp>
12 #include <boost/mpl/if.hpp>
13 #include <boost/mpl/int.hpp>
14 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
15 #include <boost/fusion/support/tag_of.hpp>
16 #include <boost/fusion/support/is_segmented.hpp>
17 #include <boost/fusion/sequence/intrinsic/detail/segmented_size.hpp>
19 namespace boost { namespace fusion
22 struct sequence_facade_tag;
23 struct boost_tuple_tag; // boost::tuples::tuple tag
24 struct boost_array_tag; // boost::array tag
25 struct mpl_sequence_tag; // mpl sequence tag
26 struct std_pair_tag; // std::pair tag
30 template <typename Tag>
33 template<typename Sequence>
34 struct unsegmented_size : Sequence::size {};
36 template <typename Sequence>
39 traits::is_segmented<Sequence>
40 , detail::segmented_size<Sequence>
41 , unsegmented_size<Sequence>
47 struct size_impl<sequence_facade_tag>
49 template <typename Sequence>
50 struct apply : Sequence::template size<Sequence> {};
54 struct size_impl<boost_tuple_tag>;
57 struct size_impl<boost_array_tag>;
60 struct size_impl<mpl_sequence_tag>;
63 struct size_impl<std_pair_tag>;
68 template <typename Sequence>
71 extension::size_impl<typename detail::tag_of<Sequence>::type>
72 ::template apply<Sequence>::type::value
76 template <typename Sequence>
77 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
78 inline typename result_of::size<Sequence>::type
81 typedef typename result_of::size<Sequence>::type result;