• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2    Copyright 2010 Neil Groves
3    Distributed under the Boost Software License, Version 1.0.
4    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5/]
6[section:mismatch mismatch]
7
8[heading Prototype]
9
10``
11template<class SinglePassRange1, class SinglePassRange2>
12std::pair<
13    typename range_iterator<SinglePassRange1>::type,
14    typename range_iterator<const SinglePassRange2>::type >
15mismatch(SinglePassRange1& rng1, const SinglePassRange2& rng2);
16
17template<class SinglePassRange1, class SinglePassRange2>
18std::pair<
19    typename range_iterator<const SinglePassRange1>::type,
20    typename range_iterator<const SinglePassRange2>::type >
21mismatch(const SinglePassRange1& rng1, const SinglePassRange2& rng2);
22
23template<class SinglePassRange1, class SinglePassRange2>
24std::pair<
25    typename range_iterator<SinglePassRange1>::type,
26    typename range_iterator<SinglePassRange2>::type >
27mismatch(SinglePassRange1& rng1, SinglePassRange2& rng2);
28
29template<class SinglePassRange1, class SinglePassRange2>
30std::pair<
31    typename range_iterator<const SinglePassRange1>::type,
32    typename range_iterator<SinglePassRange2>::type >
33mismatch(const SinglePassRange1& rng1, SinglePassRange2& rng2);
34
35
36template<
37    class SinglePassRange1,
38    class SinglePassRange2,
39    class BinaryPredicate
40    >
41std::pair<
42    typename range_iterator<SinglePassRange1>::type,
43    typename range_iterator<const SinglePassRange2>::type >
44mismatch(SinglePassRange1& rng1, const SinglePassRange2& rng2,
45         BinaryPredicate pred);
46
47template<
48    class SinglePassRange1,
49    class SinglePassRange2,
50    class BinaryPredicate
51    >
52std::pair<
53    typename range_iterator<const SinglePassRange1>::type,
54    typename range_iterator<const SinglePassRange2>::type >
55mismatch(const SinglePassRange1& rng1, const SinglePassRange2& rng2,
56         BinaryPredicate pred);
57
58template<
59    class SinglePassRange1,
60    class SinglePassRange2,
61    class BinaryPredicate
62    >
63std::pair<
64    typename range_iterator<SinglePassRange1>::type,
65    typename range_iterator<SinglePassRange2>::type >
66mismatch(SinglePassRange1& rng1, SinglePassRange2& rng2,
67         BinaryPredicate pred);
68
69template<
70    class SinglePassRange1,
71    class SinglePassRange2,
72    class BinaryPredicate
73    >
74std::pair<
75    typename range_iterator<const SinglePassRange1>::type,
76    typename range_iterator<SinglePassRange2>::type >
77mismatch(const SinglePassRange1& rng1, SinglePassRange2& rng2,
78         BinaryPredicate pred);
79``
80
81[heading Description]
82
83`mismatch` finds the first position where the corresponding elements from the two ranges `rng1` and `rng2` are not equal.
84
85Equality is determined by `operator==` for non-predicate versions of `mismatch`, and by satisfying `pred` in the predicate versions.
86
87[heading Definition]
88
89Defined in the header file `boost/range/algorithm/mismatch.hpp`
90
91[heading Requirements]
92
93[*For the non-predicate versions:]
94
95* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
96* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
97* `SinglePassRange1`'s value type is a model of the `EqualityComparableConcept`.
98* `SinglePassRange2`'s value type is a model of the `EqualityComparableConcept`.
99* `SinglePassRange1`s value type can be compared for equality with `SinglePassRange2`'s value type.
100
101[*For the predicate versions:]
102
103* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
104* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
105* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
106* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
107* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
108
109[heading Precondition:]
110
111`distance(rng2) >= distance(rng1)`
112
113[heading Complexity]
114
115Linear. At most `distance(rng1)` comparisons.
116
117[endsect]
118
119
120