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