Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:42

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(FUSION_SIZE_05052005_0214)
0008 #define FUSION_SIZE_05052005_0214
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/utility/enable_if.hpp>
0012 #include <boost/mpl/if.hpp>
0013 #include <boost/mpl/int.hpp>
0014 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
0015 #include <boost/fusion/support/tag_of.hpp>
0016 #include <boost/fusion/support/is_segmented.hpp>
0017 #include <boost/fusion/sequence/intrinsic/detail/segmented_size.hpp>
0018 
0019 namespace boost { namespace fusion
0020 {
0021     // Special tags:
0022     struct sequence_facade_tag;
0023     struct boost_tuple_tag; // boost::tuples::tuple tag
0024     struct boost_array_tag; // boost::array tag
0025     struct mpl_sequence_tag; // mpl sequence tag
0026     struct std_pair_tag; // std::pair tag
0027 
0028     namespace extension
0029     {
0030         template <typename Tag>
0031         struct size_impl
0032         {
0033             template<typename Sequence>
0034             struct unsegmented_size : Sequence::size {};
0035 
0036             template <typename Sequence>
0037             struct apply
0038               : mpl::if_<
0039                     traits::is_segmented<Sequence>
0040                   , detail::segmented_size<Sequence>
0041                   , unsegmented_size<Sequence>
0042                 >::type
0043             {};
0044         };
0045 
0046         template <>
0047         struct size_impl<sequence_facade_tag>
0048         {
0049             template <typename Sequence>
0050             struct apply : Sequence::template size<Sequence> {};
0051         };
0052 
0053         template <>
0054         struct size_impl<boost_tuple_tag>;
0055 
0056         template <>
0057         struct size_impl<boost_array_tag>;
0058 
0059         template <>
0060         struct size_impl<mpl_sequence_tag>;
0061 
0062         template <>
0063         struct size_impl<std_pair_tag>;
0064     }
0065 
0066     namespace result_of
0067     {
0068         template <typename Sequence>
0069         struct size
0070             : mpl::int_<
0071                   extension::size_impl<typename detail::tag_of<Sequence>::type>
0072                       ::template apply<Sequence>::type::value
0073               > {};
0074     }
0075 
0076     template <typename Sequence>
0077     BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0078     inline typename result_of::size<Sequence>::type
0079     size(Sequence const&)
0080     {
0081         typedef typename result_of::size<Sequence>::type result;
0082         return result();
0083     }
0084 }}
0085 
0086 #endif