~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/mpl/equal.hpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//-----------------------------------------------------------------------------
 
2
// boost mpl/equal.hpp header file
 
3
// See http://www.boost.org for updates, documentation, and revision history.
 
4
//-----------------------------------------------------------------------------
 
5
//
 
6
// Copyright (c) 2000-02
 
7
// Aleksey Gurtovoy
 
8
//
 
9
// Permission to use, copy, modify, distribute and sell this software
 
10
// and its documentation for any purpose is hereby granted without fee, 
 
11
// provided that the above copyright notice appears in all copies and 
 
12
// that both the copyright notice and this permission notice appear in 
 
13
// supporting documentation. No representations are made about the 
 
14
// suitability of this software for any purpose. It is provided "as is" 
 
15
// without express or implied warranty.
 
16
 
 
17
#ifndef BOOST_MPL_EQUAL_HPP_INCLUDED
 
18
#define BOOST_MPL_EQUAL_HPP_INCLUDED
 
19
 
 
20
#include "boost/mpl/aux_/iter_fold_if_impl.hpp"
 
21
#include "boost/mpl/aux_/iter_apply.hpp"
 
22
#include "boost/mpl/and.hpp"
 
23
#include "boost/mpl/not.hpp"
 
24
#include "boost/mpl/begin_end.hpp"
 
25
#include "boost/mpl/next.hpp"
 
26
#include "boost/mpl/always.hpp"
 
27
#include "boost/mpl/bool.hpp"
 
28
#include "boost/mpl/lambda.hpp"
 
29
#include "boost/mpl/bind.hpp"
 
30
#include "boost/mpl/apply.hpp"
 
31
#include "boost/mpl/void.hpp"
 
32
#include "boost/mpl/aux_/void_spec.hpp"
 
33
#include "boost/mpl/aux_/lambda_support.hpp"
 
34
#include "boost/type_traits/is_same.hpp"
 
35
 
 
36
namespace boost {
 
37
namespace mpl {
 
38
 
 
39
namespace aux {
 
40
 
 
41
template<
 
42
      typename Predicate
 
43
    , typename LastIterator1
 
44
    , typename LastIterator2
 
45
    >
 
46
struct equal_pred
 
47
{
 
48
    template<
 
49
          typename Iterator2
 
50
        , typename Iterator1
 
51
        >
 
52
    struct apply
 
53
    {
 
54
        typedef typename and_< 
 
55
              not_< is_same<Iterator1,LastIterator1> >
 
56
            , not_< is_same<Iterator2,LastIterator2> >
 
57
            , aux::iter_apply2<Predicate,Iterator1,Iterator2>
 
58
            >::type type;
 
59
    };
 
60
};
 
61
 
 
62
} // namespace aux
 
63
 
 
64
BOOST_MPL_AUX_AGLORITHM_NAMESPACE_BEGIN
 
65
 
 
66
template<
 
67
      typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Sequence1)
 
68
    , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Sequence2)
 
69
    , typename Predicate = is_same<_,_>
 
70
    >
 
71
struct equal
 
72
{
 
73
 private:
 
74
    typedef typename begin<Sequence1>::type first1_;
 
75
    typedef typename begin<Sequence2>::type first2_;
 
76
    typedef typename end<Sequence1>::type last1_;
 
77
    typedef typename end<Sequence2>::type last2_;
 
78
    typedef typename lambda<Predicate>::type pred_;
 
79
 
 
80
    typedef aux::iter_fold_if_impl<
 
81
          first1_
 
82
        , first2_
 
83
        , next<>
 
84
        , aux::equal_pred<pred_,last1_,last2_>
 
85
        , void_
 
86
        , always<false_>
 
87
        > fold_;
 
88
 
 
89
    typedef typename fold_::iterator iter1_;
 
90
    typedef typename fold_::state iter2_;
 
91
    typedef and_<
 
92
          is_same<iter1_,last1_>
 
93
        , is_same<iter2_,last2_>
 
94
        > result_;
 
95
 
 
96
 public:
 
97
    typedef typename result_::type type;
 
98
 
 
99
    BOOST_MPL_AUX_LAMBDA_SUPPORT(2,equal,(Sequence1,Sequence2))
 
100
};
 
101
 
 
102
BOOST_MPL_AUX_AGLORITHM_NAMESPACE_END
 
103
 
 
104
BOOST_MPL_AUX_ALGORITHM_VOID_SPEC(2, equal)
 
105
 
 
106
} // namespace mpl
 
107
} // namespace boost
 
108
 
 
109
#endif // BOOST_MPL_EQUAL_HPP_INCLUDED