• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Algorithms/Querying Algorithms//equal |100
2
3equal
4=====
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename Seq1
13        , typename Seq2
14        , typename Pred = is_same<_1,_2>
15        >
16    struct equal
17    {
18        typedef |unspecified| type;
19    };
20
21
22
23Description
24-----------
25
26Returns a true-valued |Integral Constant| if the two sequences ``Seq1``
27and ``Seq2`` are identical when compared element-by-element.
28
29
30Header
31------
32
33.. parsed-literal::
34
35    #include <boost/mpl/equal.hpp>
36
37
38
39Parameters
40----------
41
42+-------------------+-------------------------------+-----------------------------------+
43| Parameter         | Requirement                   | Description                       |
44+===================+===============================+===================================+
45| ``Seq1``, ``Seq2``| |Forward Sequence|            | Sequences to compare.             |
46+-------------------+-------------------------------+-----------------------------------+
47| ``Pred``          | Binary |Lambda Expression|    | A comparison criterion.           |
48+-------------------+-------------------------------+-----------------------------------+
49
50
51Expression semantics
52--------------------
53
54For any |Forward Sequence|\ s ``s1`` and ``s2`` and a binary |Lambda Expression| ``pred``:
55
56
57.. parsed-literal::
58
59    typedef equal<s1,s2,pred>::type c;
60
61:Return type:
62    |Integral Constant|
63
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
67
68    .. parsed-literal::
69
70        advance< begin<s2>::type, distance< begin<s1>::type,i >::type >::type
71
72
73Complexity
74----------
75
76Linear. At most ``size<s1>::value`` comparisons.
77
78
79Example
80-------
81
82.. parsed-literal::
83
84    typedef vector<char,int,unsigned,long,unsigned long> s1;
85    typedef list<char,int,unsigned,long,unsigned long> s2;
86
87    BOOST_MPL_ASSERT(( equal<s1,s2> ));
88
89
90See also
91--------
92
93|Querying Algorithms|, |find|, |find_if|
94
95
96.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
97   Distributed under the Boost Software License, Version 1.0. (See accompanying
98   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
99