# equal

### Synopsis

    template<
          typename Sequence1
        , typename Sequence2
        , typename Pred = is_same<_1,_2>
        >
    struct equal
    {
        typedef unspecified type;
    };

### Description

Returns `true_` if the two sequences `Sequence1` and `Sequence2` are identical when compared element-by-element, and otherwise returns `false_`.

### Definition

    #include "boost/mpl/equal.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence1`, `Sequence2` | A model of Forward Sequence | Sequences to compare.
`Pred` | A binary Predicate [Lambda Expression] | The comparison metafunction.

### Expression semantics

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`. |

### Complexity

Linear. At most `size<Sequence1>::value` comparisons.

### Example

    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));

### See also

Algorithms, `count`, `count_if`

Table of Contents
Last edited March 10, 2003 5:39 am