diff --git a/trunk/boost/mpl/equal.hpp b/trunk/boost/mpl/equal.hpp
a
|
b
|
|
4 | 4 | |
5 | 5 | // Copyright Aleksey Gurtovoy 2000-2004 |
6 | 6 | // |
7 | | // Distributed under the Boost Software License, Version 1.0. |
8 | | // (See accompanying file LICENSE_1_0.txt or copy at |
| 7 | // Distributed under the Boost Software License, Version 1.0. |
| 8 | // (See accompanying file LICENSE_1_0.txt or copy at |
9 | 9 | // http://www.boost.org/LICENSE_1_0.txt) |
10 | 10 | // |
11 | 11 | // See http://www.boost.org/libs/mpl for documentation. |
… |
… |
|
14 | 14 | // $Date$ |
15 | 15 | // $Revision$ |
16 | 16 | |
| 17 | #include <boost/mpl/always.hpp> |
| 18 | #include <boost/mpl/and.hpp> |
| 19 | #include <boost/mpl/apply.hpp> |
| 20 | #include <boost/mpl/aux_/iter_apply.hpp> |
17 | 21 | #include <boost/mpl/aux_/iter_fold_if_impl.hpp> |
18 | | #include <boost/mpl/aux_/iter_apply.hpp> |
19 | | #include <boost/mpl/and.hpp> |
20 | | #include <boost/mpl/not.hpp> |
| 22 | #include <boost/mpl/aux_/lambda_support.hpp> |
| 23 | #include <boost/mpl/aux_/msvc_eti_base.hpp> |
| 24 | #include <boost/mpl/aux_/na_spec.hpp> |
21 | 25 | #include <boost/mpl/begin_end.hpp> |
22 | | #include <boost/mpl/next.hpp> |
23 | | #include <boost/mpl/always.hpp> |
| 26 | #include <boost/mpl/bind.hpp> |
24 | 27 | #include <boost/mpl/bool.hpp> |
25 | 28 | #include <boost/mpl/lambda.hpp> |
26 | | #include <boost/mpl/bind.hpp> |
27 | | #include <boost/mpl/apply.hpp> |
| 29 | #include <boost/mpl/next.hpp> |
| 30 | #include <boost/mpl/not.hpp> |
| 31 | #include <boost/mpl/quote.hpp> |
28 | 32 | #include <boost/mpl/void.hpp> |
29 | | #include <boost/mpl/aux_/na_spec.hpp> |
30 | | #include <boost/mpl/aux_/lambda_support.hpp> |
31 | | #include <boost/mpl/aux_/msvc_eti_base.hpp> |
32 | 33 | |
33 | 34 | #include <boost/type_traits/is_same.hpp> |
34 | 35 | |
… |
… |
|
49 | 50 | > |
50 | 51 | struct apply |
51 | 52 | { |
52 | | typedef typename and_< |
| 53 | typedef typename and_< |
53 | 54 | not_< is_same<Iterator1,LastIterator1> > |
54 | 55 | , not_< is_same<Iterator2,LastIterator2> > |
55 | 56 | , aux::iter_apply2<Predicate,Iterator1,Iterator2> |
… |
… |
|
87 | 88 | |
88 | 89 | typedef typename result_::type type; |
89 | 90 | }; |
90 | | |
91 | | |
92 | 91 | } // namespace aux |
93 | 92 | |
94 | 93 | |
95 | 94 | template< |
96 | 95 | typename BOOST_MPL_AUX_NA_PARAM(Sequence1) |
97 | 96 | , typename BOOST_MPL_AUX_NA_PARAM(Sequence2) |
98 | | , typename Predicate = is_same<_,_> |
| 97 | , typename Predicate = quote2<is_same> |
99 | 98 | > |
100 | 99 | struct equal |
101 | | : aux::msvc_eti_base< |
| 100 | : aux::msvc_eti_base< |
102 | 101 | typename aux::equal_impl<Sequence1,Sequence2,Predicate>::type |
103 | 102 | >::type |
104 | 103 | { |
105 | | BOOST_MPL_AUX_LAMBDA_SUPPORT(2,equal,(Sequence1,Sequence2)) |
| 104 | BOOST_MPL_AUX_LAMBDA_SUPPORT(3,equal,(Sequence1,Sequence2)) |
106 | 105 | }; |
107 | 106 | |
108 | | BOOST_MPL_AUX_NA_SPEC(2, equal) |
| 107 | BOOST_MPL_AUX_NA_SPEC(3, equal) |
109 | 108 | |
110 | 109 | }} |
111 | 110 | |
diff --git a/trunk/libs/mpl/doc/src/refmanual/equal.rst b/trunk/libs/mpl/doc/src/refmanual/equal.rst
a
|
b
|
|
7 | 7 | -------- |
8 | 8 | |
9 | 9 | .. parsed-literal:: |
10 | | |
| 10 | |
11 | 11 | template< |
12 | 12 | typename Seq1 |
13 | 13 | , typename Seq2 |
14 | | , typename Pred = is_same<_1,_2> |
| 14 | , typename Pred = quote2<is_same> |
15 | 15 | > |
16 | 16 | struct equal |
17 | 17 | { |
… |
… |
|
23 | 23 | Description |
24 | 24 | ----------- |
25 | 25 | |
26 | | Returns a true-valued |Integral Constant| if the two sequences ``Seq1`` |
| 26 | Returns a true-valued |Integral Constant| if the two sequences ``Seq1`` |
27 | 27 | and ``Seq2`` are identical when compared element-by-element. |
28 | 28 | |
29 | 29 | |
… |
… |
|
31 | 31 | ------ |
32 | 32 | |
33 | 33 | .. parsed-literal:: |
34 | | |
| 34 | |
35 | 35 | #include <boost/mpl/equal.hpp> |
36 | 36 | |
37 | 37 | |
… |
… |
|
56 | 56 | |
57 | 57 | .. parsed-literal:: |
58 | 58 | |
59 | | typedef equal<s1,s2,pred>::type c; |
| 59 | typedef equal<s1,s2,pred>::type c; |
60 | 60 | |
61 | 61 | :Return type: |
62 | 62 | |Integral Constant| |
63 | 63 | |
64 | 64 | :Semantics: |
65 | | ``c::value == true`` is and only if ``size<s1>::value == size<s2>::value`` |
66 | | and for every iterator ``i`` in |begin/end<s1>| ``deref<i>::type`` is identical to |
| 65 | ``c::value == true`` is and only if ``size<s1>::value == size<s2>::value`` |
| 66 | and for every iterator ``i`` in |begin/end<s1>| ``deref<i>::type`` is identical to |
67 | 67 | |
68 | 68 | .. parsed-literal:: |
69 | 69 | |
… |
… |
|
73 | 73 | Complexity |
74 | 74 | ---------- |
75 | 75 | |
76 | | Linear. At most ``size<s1>::value`` comparisons. |
| 76 | Linear. At most ``size<s1>::value`` comparisons. |
77 | 77 | |
78 | 78 | |
79 | 79 | Example |
80 | 80 | ------- |
81 | 81 | |
82 | 82 | .. parsed-literal:: |
83 | | |
| 83 | |
84 | 84 | typedef vector<char,int,unsigned,long,unsigned long> s1; |
85 | 85 | typedef list<char,int,unsigned,long,unsigned long> s2; |
86 | | |
| 86 | |
87 | 87 | BOOST_MPL_ASSERT(( equal<s1,s2> )); |
88 | 88 | |
89 | 89 | |
diff --git a/trunk/libs/mpl/test/Jamfile.v2 b/trunk/libs/mpl/test/Jamfile.v2
a
|
b
|
|
17 | 17 | compile bind.cpp ; |
18 | 18 | compile bitwise.cpp ; |
19 | 19 | run bool.cpp ; |
| 20 | compile bug_equal_default_lambda.cpp ; |
20 | 21 | compile comparison.cpp ; |
21 | 22 | compile contains.cpp ; |
22 | 23 | compile copy.cpp ; |
diff --git a/trunk/libs/mpl/test/bug_equal_default_lambda.cpp b/trunk/libs/mpl/test/bug_equal_default_lambda.cpp
new file mode 10644
-
|
+
|
|
| 1 | // Copyright Louis Dionne 2013 |
| 2 | // |
| 3 | // Distributed under the Boost Software License,Version 1.0. |
| 4 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 5 | // http://www.boost.org/LICENSE_1_0.txt) |
| 6 | // |
| 7 | // See http://www.boost.org/libs/mpl for documentation. |
| 8 | |
| 9 | |
| 10 | // Test case for the bug reported at: |
| 11 | // https://svn.boost.org/trac/boost/ticket/8608 |
| 12 | |
| 13 | |
| 14 | #include <boost/mpl/assert.hpp> |
| 15 | #include <boost/mpl/equal.hpp> |
| 16 | #include <boost/mpl/find_if.hpp> |
| 17 | #include <boost/mpl/placeholders.hpp> |
| 18 | #include <boost/mpl/vector.hpp> |
| 19 | #include <boost/type_traits/is_same.hpp> |
| 20 | |
| 21 | |
| 22 | using namespace boost; |
| 23 | using namespace boost::mpl; |
| 24 | |
| 25 | |
| 26 | template <typename VectorOfVectors, typename Vector> |
| 27 | struct find_vector |
| 28 | : find_if< |
| 29 | VectorOfVectors, equal<Vector, _1> |
| 30 | > |
| 31 | { }; |
| 32 | |
| 33 | typedef find_vector< |
| 34 | vector< |
| 35 | vector<int, int>, |
| 36 | vector<char, char> |
| 37 | >, |
| 38 | vector<char, char> |
| 39 | >::type ThisShouldNotBreak; |