...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template< typename Sequence1 , typename Sequence2 , typename Pred = is_same<_1,_2> > struct equal { typedef unspecified type; };
Returns true_
if the two sequences Sequence1
and Sequence2
are identical when compared element-by-element, and otherwise returns false_
.
#include "boost/mpl/equal.hpp"
Parameter | Requirement | Description |
---|---|---|
Sequence1 , Sequence2 | A model of Forward Sequence | Sequences to compare. |
Pred | A binary Predicate [Lambda Expression] | The comparison metafunction. |
Expression | Expression type | Precondition | Semantics | Postcondition |
---|---|---|---|---|
typedef equal<Sequence1,Sequence2,Pred>::type c; | A model of Integral Constant | c::value == true is and only if size<Sequence1>::type::value == size<Sequence2>::type::value and for every iterator i in [begin<Sequence>::type,end<Sequence>::type) i::type is identical to advance< begin<Sequence2>::type, distance< begin<Sequence1>::type,i >::type >::type . |
Linear. At most size<Sequence1>::value
comparisons.
typedef vector<char,int,unsigned,long,unsigned long> s1; typedef list<char,int,unsigned,long,unsigned long> s2; BOOST_STATIC_ASSERT((equal<s1,s2>::type::value));