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/utility/enable_if.hpp>
11 #include <boost/mpl/if.hpp>
12 #include <boost/mpl/int.hpp>
13 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
14 #include <boost/fusion/support/tag_of.hpp>
15 #include <boost/fusion/support/is_segmented.hpp>
16 #include <boost/fusion/sequence/intrinsic/detail/segmented_size.hpp>
18 namespace boost { namespace fusion
21 struct sequence_facade_tag;
22 struct boost_tuple_tag; // boost::tuples::tuple tag
23 struct boost_array_tag; // boost::array tag
24 struct mpl_sequence_tag; // mpl sequence tag
25 struct std_pair_tag; // std::pair tag
29 template <typename Tag>
32 template<typename Sequence>
33 struct unsegmented_size : Sequence::size {};
35 template <typename Sequence>
38 traits::is_segmented<Sequence>
39 , detail::segmented_size<Sequence>
40 , unsegmented_size<Sequence>
46 struct size_impl<sequence_facade_tag>
48 template <typename Sequence>
49 struct apply : Sequence::template size<Sequence> {};
53 struct size_impl<boost_tuple_tag>;
56 struct size_impl<boost_array_tag>;
59 struct size_impl<mpl_sequence_tag>;
62 struct size_impl<std_pair_tag>;
67 template <typename Sequence>
69 : extension::size_impl<typename detail::tag_of<Sequence>::type>::
70 template apply<Sequence>
73 typedef typename extension::size_impl<typename detail::tag_of<Sequence>::type>::
74 template apply<Sequence>::type size_application;
75 BOOST_STATIC_CONSTANT(int, value = size_application::value);
79 template <typename Sequence>
80 inline typename result_of::size<Sequence>::type
83 typedef typename result_of::size<Sequence>::type result;