]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/mpl/equal.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
45a21f4074e0b99883ca65960681638e3df3cd8f
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / equal.hpp
1 \r
2 #ifndef BOOST_MPL_EQUAL_HPP_INCLUDED\r
3 #define BOOST_MPL_EQUAL_HPP_INCLUDED\r
4 \r
5 // Copyright Aleksey Gurtovoy 2000-2004\r
6 //\r
7 // Distributed under the Boost Software License, Version 1.0. \r
8 // (See accompanying file LICENSE_1_0.txt or copy at \r
9 // http://www.boost.org/LICENSE_1_0.txt)\r
10 //\r
11 // See http://www.boost.org/libs/mpl for documentation.\r
12 \r
13 // $Id: equal.hpp 49267 2008-10-11 06:19:02Z agurtovoy $\r
14 // $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $\r
15 // $Revision: 49267 $\r
16 \r
17 #include <boost/mpl/aux_/iter_fold_if_impl.hpp>\r
18 #include <boost/mpl/aux_/iter_apply.hpp>\r
19 #include <boost/mpl/and.hpp>\r
20 #include <boost/mpl/not.hpp>\r
21 #include <boost/mpl/begin_end.hpp>\r
22 #include <boost/mpl/next.hpp>\r
23 #include <boost/mpl/always.hpp>\r
24 #include <boost/mpl/bool.hpp>\r
25 #include <boost/mpl/lambda.hpp>\r
26 #include <boost/mpl/bind.hpp>\r
27 #include <boost/mpl/apply.hpp>\r
28 #include <boost/mpl/void.hpp>\r
29 #include <boost/mpl/aux_/na_spec.hpp>\r
30 #include <boost/mpl/aux_/lambda_support.hpp>\r
31 #include <boost/mpl/aux_/msvc_eti_base.hpp>\r
32 \r
33 #include <boost/type_traits/is_same.hpp>\r
34 \r
35 namespace boost { namespace mpl {\r
36 \r
37 namespace aux {\r
38 \r
39 template<\r
40       typename Predicate\r
41     , typename LastIterator1\r
42     , typename LastIterator2\r
43     >\r
44 struct equal_pred\r
45 {\r
46     template<\r
47           typename Iterator2\r
48         , typename Iterator1\r
49         >\r
50     struct apply\r
51     {\r
52         typedef typename and_< \r
53               not_< is_same<Iterator1,LastIterator1> >\r
54             , not_< is_same<Iterator2,LastIterator2> >\r
55             , aux::iter_apply2<Predicate,Iterator1,Iterator2>\r
56             >::type type;\r
57     };\r
58 };\r
59 \r
60 template<\r
61       typename Sequence1\r
62     , typename Sequence2\r
63     , typename Predicate\r
64     >\r
65 struct equal_impl\r
66 {\r
67     typedef typename begin<Sequence1>::type first1_;\r
68     typedef typename begin<Sequence2>::type first2_;\r
69     typedef typename end<Sequence1>::type last1_;\r
70     typedef typename end<Sequence2>::type last2_;\r
71 \r
72     typedef aux::iter_fold_if_impl<\r
73           first1_\r
74         , first2_\r
75         , next<>\r
76         , protect< aux::equal_pred<Predicate,last1_,last2_> >\r
77         , void_\r
78         , always<false_>\r
79         > fold_;\r
80 \r
81     typedef typename fold_::iterator iter1_;\r
82     typedef typename fold_::state iter2_;\r
83     typedef and_<\r
84           is_same<iter1_,last1_>\r
85         , is_same<iter2_,last2_>\r
86         > result_;\r
87 \r
88     typedef typename result_::type type;\r
89 };\r
90 \r
91 \r
92 } // namespace aux\r
93 \r
94 \r
95 template<\r
96       typename BOOST_MPL_AUX_NA_PARAM(Sequence1)\r
97     , typename BOOST_MPL_AUX_NA_PARAM(Sequence2)\r
98     , typename Predicate = is_same<_,_>\r
99     >\r
100 struct equal\r
101     : aux::msvc_eti_base< \r
102           typename aux::equal_impl<Sequence1,Sequence2,Predicate>::type\r
103         >::type\r
104 {\r
105     BOOST_MPL_AUX_LAMBDA_SUPPORT(2,equal,(Sequence1,Sequence2))\r
106 };\r
107 \r
108 BOOST_MPL_AUX_NA_SPEC(2, equal)\r
109 \r
110 }}\r
111 \r
112 #endif // BOOST_MPL_EQUAL_HPP_INCLUDED\r