File indexing completed on 2025-12-15 09:57:29
0001
0002 #ifndef BOOST_MPL_DISTANCE_HPP_INCLUDED
0003 #define BOOST_MPL_DISTANCE_HPP_INCLUDED
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <boost/mpl/distance_fwd.hpp>
0018 #include <boost/mpl/iter_fold.hpp>
0019 #include <boost/mpl/iterator_range.hpp>
0020 #include <boost/mpl/long.hpp>
0021 #include <boost/mpl/next.hpp>
0022 #include <boost/mpl/tag.hpp>
0023 #include <boost/mpl/apply_wrap.hpp>
0024 #include <boost/mpl/aux_/msvc_eti_base.hpp>
0025 #include <boost/mpl/aux_/value_wknd.hpp>
0026 #include <boost/mpl/aux_/na_spec.hpp>
0027 #include <boost/mpl/aux_/config/forwarding.hpp>
0028 #include <boost/mpl/aux_/config/static_constant.hpp>
0029
0030
0031 namespace boost { namespace mpl {
0032
0033
0034 template< typename Tag > struct distance_impl
0035 {
0036 template< typename First, typename Last > struct apply
0037 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
0038 : aux::msvc_eti_base< typename iter_fold<
0039 iterator_range<First,Last>
0040 , mpl::long_<0>
0041 , next<>
0042 >::type >
0043 {
0044 #else
0045 {
0046 typedef typename iter_fold<
0047 iterator_range<First,Last>
0048 , mpl::long_<0>
0049 , next<>
0050 >::type type;
0051
0052 BOOST_STATIC_CONSTANT(long, value =
0053 (iter_fold<
0054 iterator_range<First,Last>
0055 , mpl::long_<0>
0056 , next<>
0057 >::type::value)
0058 );
0059 #endif
0060 };
0061 };
0062
0063 template<
0064 typename BOOST_MPL_AUX_NA_PARAM(First)
0065 , typename BOOST_MPL_AUX_NA_PARAM(Last)
0066 >
0067 struct distance
0068 : distance_impl< typename tag<First>::type >
0069 ::template apply<First, Last>
0070 {
0071 BOOST_MPL_AUX_LAMBDA_SUPPORT(2, distance, (First, Last))
0072 };
0073
0074 BOOST_MPL_AUX_NA_SPEC(2, distance)
0075
0076 }}
0077
0078 #endif