os/ossrv/ossrv_pub/boost_apis/boost/mpl/distance.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
sl@0
     2
#ifndef BOOST_MPL_DISTANCE_HPP_INCLUDED
sl@0
     3
#define BOOST_MPL_DISTANCE_HPP_INCLUDED
sl@0
     4
sl@0
     5
// Copyright Aleksey Gurtovoy 2000-2004
sl@0
     6
//
sl@0
     7
// Distributed under the Boost Software License, Version 1.0. 
sl@0
     8
// (See accompanying file LICENSE_1_0.txt or copy at 
sl@0
     9
// http://www.boost.org/LICENSE_1_0.txt)
sl@0
    10
//
sl@0
    11
// See http://www.boost.org/libs/mpl for documentation.
sl@0
    12
sl@0
    13
// $Source: /cvsroot/boost/boost/boost/mpl/distance.hpp,v $
sl@0
    14
// $Date: 2005/01/26 01:58:33 $
sl@0
    15
// $Revision: 1.10 $
sl@0
    16
sl@0
    17
#include <boost/mpl/distance_fwd.hpp>
sl@0
    18
#include <boost/mpl/iter_fold.hpp>
sl@0
    19
#include <boost/mpl/iterator_range.hpp>
sl@0
    20
#include <boost/mpl/long.hpp>
sl@0
    21
#include <boost/mpl/next.hpp>
sl@0
    22
#include <boost/mpl/tag.hpp>
sl@0
    23
#include <boost/mpl/apply_wrap.hpp>
sl@0
    24
#include <boost/mpl/aux_/msvc_eti_base.hpp>
sl@0
    25
#include <boost/mpl/aux_/value_wknd.hpp>
sl@0
    26
#include <boost/mpl/aux_/na_spec.hpp>
sl@0
    27
#include <boost/mpl/aux_/config/forwarding.hpp>
sl@0
    28
#include <boost/mpl/aux_/config/static_constant.hpp>
sl@0
    29
sl@0
    30
sl@0
    31
namespace boost { namespace mpl {
sl@0
    32
sl@0
    33
// default implementation for forward/bidirectional iterators
sl@0
    34
template< typename Tag > struct distance_impl
sl@0
    35
{
sl@0
    36
    template< typename First, typename Last > struct apply
sl@0
    37
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
sl@0
    38
        : aux::msvc_eti_base< typename iter_fold<
sl@0
    39
              iterator_range<First,Last>
sl@0
    40
            , mpl::long_<0>
sl@0
    41
            , next<>
sl@0
    42
            >::type >
sl@0
    43
    {
sl@0
    44
#else
sl@0
    45
    {
sl@0
    46
        typedef typename iter_fold<
sl@0
    47
              iterator_range<First,Last>
sl@0
    48
            , mpl::long_<0>
sl@0
    49
            , next<>
sl@0
    50
            >::type type;
sl@0
    51
        
sl@0
    52
        BOOST_STATIC_CONSTANT(long, value =
sl@0
    53
              (iter_fold<
sl@0
    54
                  iterator_range<First,Last>
sl@0
    55
                , mpl::long_<0>
sl@0
    56
                , next<>
sl@0
    57
                >::type::value)
sl@0
    58
            );
sl@0
    59
#endif
sl@0
    60
    };
sl@0
    61
};
sl@0
    62
sl@0
    63
template<
sl@0
    64
      typename BOOST_MPL_AUX_NA_PARAM(First)
sl@0
    65
    , typename BOOST_MPL_AUX_NA_PARAM(Last)
sl@0
    66
    >
sl@0
    67
struct distance
sl@0
    68
    : distance_impl< typename tag<First>::type >
sl@0
    69
        ::template apply<First, Last>
sl@0
    70
{
sl@0
    71
    BOOST_MPL_AUX_LAMBDA_SUPPORT(2, distance, (First, Last))
sl@0
    72
};
sl@0
    73
sl@0
    74
BOOST_MPL_AUX_NA_SPEC(2, distance)
sl@0
    75
sl@0
    76
}}
sl@0
    77
sl@0
    78
#endif // BOOST_MPL_DISTANCE_HPP_INCLUDED