Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*=============================================================================
0002     Copyright (c) 2011 Eric Niebler
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(BOOST_FUSION_SEGMENTED_SIZE_08112006_1141)
0008 #define BOOST_FUSION_SEGMENTED_SIZE_08112006_1141
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/type_traits/add_const.hpp>
0012 #include <boost/type_traits/remove_reference.hpp>
0013 #include <boost/mpl/fold.hpp>
0014 #include <boost/mpl/plus.hpp>
0015 #include <boost/mpl/size_t.hpp>
0016 #include <boost/mpl/placeholders.hpp>
0017 #include <boost/fusion/sequence/intrinsic_fwd.hpp>
0018 #include <boost/fusion/mpl/begin.hpp>
0019 #include <boost/fusion/mpl/end.hpp>
0020 #include <boost/fusion/support/is_segmented.hpp>
0021 
0022 namespace boost { namespace fusion { namespace detail
0023 {
0024     ///////////////////////////////////////////////////////////////////////////
0025     // calculates the size of any segmented data structure.
0026     template<typename Sequence>
0027     struct segmented_size;
0028 
0029     ///////////////////////////////////////////////////////////////////////////
0030     template<typename Sequence, bool IsSegmented = traits::is_segmented<Sequence>::value>
0031     struct segmented_size_impl
0032       : mpl::fold<
0033             typename remove_reference<
0034                 typename add_const<
0035                     typename result_of::segments<Sequence>::type
0036                 >::type
0037             >::type
0038           , mpl::size_t<0>
0039           , mpl::plus<mpl::_1, segmented_size<remove_reference<mpl::_2> > >
0040         >::type
0041     {};
0042 
0043     template<typename Sequence>
0044     struct segmented_size_impl<Sequence, false>
0045       : result_of::size<Sequence>::type
0046     {};
0047 
0048     template<typename Sequence>
0049     struct segmented_size
0050       : segmented_size_impl<Sequence>
0051     {};
0052 
0053 }}}
0054 
0055 #endif