os/ossrv/ossrv_pub/boost_apis/boost/mpl/equal.hpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
sl@0
     2
#ifndef BOOST_MPL_EQUAL_HPP_INCLUDED
sl@0
     3
#define BOOST_MPL_EQUAL_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/equal.hpp,v $
sl@0
    14
// $Date: 2004/09/02 15:40:41 $
sl@0
    15
// $Revision: 1.6 $
sl@0
    16
sl@0
    17
#include <boost/mpl/aux_/iter_fold_if_impl.hpp>
sl@0
    18
#include <boost/mpl/aux_/iter_apply.hpp>
sl@0
    19
#include <boost/mpl/and.hpp>
sl@0
    20
#include <boost/mpl/not.hpp>
sl@0
    21
#include <boost/mpl/begin_end.hpp>
sl@0
    22
#include <boost/mpl/next.hpp>
sl@0
    23
#include <boost/mpl/always.hpp>
sl@0
    24
#include <boost/mpl/bool.hpp>
sl@0
    25
#include <boost/mpl/lambda.hpp>
sl@0
    26
#include <boost/mpl/bind.hpp>
sl@0
    27
#include <boost/mpl/apply.hpp>
sl@0
    28
#include <boost/mpl/void.hpp>
sl@0
    29
#include <boost/mpl/aux_/na_spec.hpp>
sl@0
    30
#include <boost/mpl/aux_/lambda_support.hpp>
sl@0
    31
#include <boost/mpl/aux_/msvc_eti_base.hpp>
sl@0
    32
sl@0
    33
#include <boost/type_traits/is_same.hpp>
sl@0
    34
sl@0
    35
namespace boost { namespace mpl {
sl@0
    36
sl@0
    37
namespace aux {
sl@0
    38
sl@0
    39
template<
sl@0
    40
      typename Predicate
sl@0
    41
    , typename LastIterator1
sl@0
    42
    , typename LastIterator2
sl@0
    43
    >
sl@0
    44
struct equal_pred
sl@0
    45
{
sl@0
    46
    template<
sl@0
    47
          typename Iterator2
sl@0
    48
        , typename Iterator1
sl@0
    49
        >
sl@0
    50
    struct apply
sl@0
    51
    {
sl@0
    52
        typedef typename and_< 
sl@0
    53
              not_< is_same<Iterator1,LastIterator1> >
sl@0
    54
            , not_< is_same<Iterator2,LastIterator2> >
sl@0
    55
            , aux::iter_apply2<Predicate,Iterator1,Iterator2>
sl@0
    56
            >::type type;
sl@0
    57
    };
sl@0
    58
};
sl@0
    59
sl@0
    60
template<
sl@0
    61
      typename Sequence1
sl@0
    62
    , typename Sequence2
sl@0
    63
    , typename Predicate
sl@0
    64
    >
sl@0
    65
struct equal_impl
sl@0
    66
{
sl@0
    67
    typedef typename begin<Sequence1>::type first1_;
sl@0
    68
    typedef typename begin<Sequence2>::type first2_;
sl@0
    69
    typedef typename end<Sequence1>::type last1_;
sl@0
    70
    typedef typename end<Sequence2>::type last2_;
sl@0
    71
sl@0
    72
    typedef aux::iter_fold_if_impl<
sl@0
    73
          first1_
sl@0
    74
        , first2_
sl@0
    75
        , next<>
sl@0
    76
        , protect< aux::equal_pred<Predicate,last1_,last2_> >
sl@0
    77
        , void_
sl@0
    78
        , always<false_>
sl@0
    79
        > fold_;
sl@0
    80
sl@0
    81
    typedef typename fold_::iterator iter1_;
sl@0
    82
    typedef typename fold_::state iter2_;
sl@0
    83
    typedef and_<
sl@0
    84
          is_same<iter1_,last1_>
sl@0
    85
        , is_same<iter2_,last2_>
sl@0
    86
        > result_;
sl@0
    87
sl@0
    88
    typedef typename result_::type type;
sl@0
    89
};
sl@0
    90
sl@0
    91
sl@0
    92
} // namespace aux
sl@0
    93
sl@0
    94
sl@0
    95
template<
sl@0
    96
      typename BOOST_MPL_AUX_NA_PARAM(Sequence1)
sl@0
    97
    , typename BOOST_MPL_AUX_NA_PARAM(Sequence2)
sl@0
    98
    , typename Predicate = is_same<_,_>
sl@0
    99
    >
sl@0
   100
struct equal
sl@0
   101
    : aux::msvc_eti_base< 
sl@0
   102
          typename aux::equal_impl<Sequence1,Sequence2,Predicate>::type
sl@0
   103
        >::type
sl@0
   104
{
sl@0
   105
    BOOST_MPL_AUX_LAMBDA_SUPPORT(2,equal,(Sequence1,Sequence2))
sl@0
   106
};
sl@0
   107
sl@0
   108
BOOST_MPL_AUX_NA_SPEC(2, equal)
sl@0
   109
sl@0
   110
}}
sl@0
   111
sl@0
   112
#endif // BOOST_MPL_EQUAL_HPP_INCLUDED