tmp/tmpq_hi5jn7/{from.md → to.md}
RENAMED
|
@@ -103,11 +103,11 @@ template<class ForwardIterator1, class ForwardIterator2,
|
|
| 103 |
```
|
| 104 |
|
| 105 |
*Effects:* Finds a subsequence of equal values in a sequence.
|
| 106 |
|
| 107 |
*Returns:* The last iterator `i` in the range \[`first1`,
|
| 108 |
-
`last1 - (last2 - first2)`) such that for
|
| 109 |
`n < (last2 - first2)`, the following corresponding conditions hold:
|
| 110 |
`*(i + n) == *(first2 + n), pred(*(i + n), *(first2 + n)) != false`.
|
| 111 |
Returns `last1` if \[`first2`, `last2`) is empty or if no such iterator
|
| 112 |
is found.
|
| 113 |
|
|
@@ -192,24 +192,39 @@ template<class InputIterator1, class InputIterator2>
|
|
| 192 |
template<class InputIterator1, class InputIterator2,
|
| 193 |
class BinaryPredicate>
|
| 194 |
pair<InputIterator1, InputIterator2>
|
| 195 |
mismatch(InputIterator1 first1, InputIterator1 last1,
|
| 196 |
InputIterator2 first2, BinaryPredicate pred);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
```
|
| 198 |
|
|
|
|
|
|
|
|
|
|
| 199 |
*Returns:* A pair of iterators `i` and `j` such that
|
| 200 |
`j == first2 + (i - first1)` and `i` is the first iterator in the range
|
| 201 |
\[`first1`, `last1`) for which the following corresponding conditions
|
| 202 |
hold:
|
| 203 |
|
| 204 |
-
```
|
| 205 |
-
!(*i == *(first2 + (i - first1)))
|
| 206 |
-
pred(*i, *(first2 + (i - first1))) == false
|
| 207 |
-
```
|
| 208 |
|
| 209 |
-
Returns the pair `
|
| 210 |
-
|
|
|
|
| 211 |
|
| 212 |
*Complexity:* At most `last1 - first1` applications of the corresponding
|
| 213 |
predicate.
|
| 214 |
|
| 215 |
### Equal <a id="alg.equal">[[alg.equal]]</a>
|
|
@@ -221,19 +236,36 @@ template<class InputIterator1, class InputIterator2>
|
|
| 221 |
|
| 222 |
template<class InputIterator1, class InputIterator2,
|
| 223 |
class BinaryPredicate>
|
| 224 |
bool equal(InputIterator1 first1, InputIterator1 last1,
|
| 225 |
InputIterator2 first2, BinaryPredicate pred);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
```
|
| 227 |
|
| 228 |
-
*
|
| 229 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
`*i == *(first2 + (i - first1)), pred(*i, *(first2 + (i - first1))) != false`.
|
| 231 |
Otherwise, returns `false`.
|
| 232 |
|
| 233 |
-
*Complexity:*
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
| 235 |
|
| 236 |
### Is permutation <a id="alg.is_permutation">[[alg.is_permutation]]</a>
|
| 237 |
|
| 238 |
``` cpp
|
| 239 |
template<class ForwardIterator1, class ForwardIterator2>
|
|
@@ -241,27 +273,43 @@ template<class ForwardIterator1, class ForwardIterator2>
|
|
| 241 |
ForwardIterator2 first2);
|
| 242 |
template<class ForwardIterator1, class ForwardIterator2,
|
| 243 |
class BinaryPredicate>
|
| 244 |
bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 245 |
ForwardIterator2 first2, BinaryPredicate pred);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
```
|
| 247 |
|
| 248 |
-
*Requires:*
|
| 249 |
same value type. The comparison function shall be an equivalence
|
| 250 |
relation.
|
| 251 |
|
| 252 |
-
*
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
`ForwardIterator2 begin`, such that `equal(first1, last1, begin)`
|
| 255 |
returns `true` or `equal(first1, last1, begin, pred)` returns `true`;
|
| 256 |
otherwise, returns `false`.
|
| 257 |
|
| 258 |
-
*Complexity:*
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
|
| 264 |
### Search <a id="alg.search">[[alg.search]]</a>
|
| 265 |
|
| 266 |
``` cpp
|
| 267 |
template<class ForwardIterator1, class ForwardIterator2>
|
|
@@ -278,11 +326,11 @@ template<class ForwardIterator1, class ForwardIterator2,
|
|
| 278 |
```
|
| 279 |
|
| 280 |
*Effects:* Finds a subsequence of equal values in a sequence.
|
| 281 |
|
| 282 |
*Returns:* The first iterator `i` in the range \[`first1`,
|
| 283 |
-
`last1 - (last2-first2)`) such that for
|
| 284 |
less than `last2 - first2` the following corresponding conditions hold:
|
| 285 |
`*(i + n) == *(first2 + n), pred(*(i + n), *(first2 + n)) != false`.
|
| 286 |
Returns `first1` if \[`first2`, `last2`) is empty, otherwise returns
|
| 287 |
`last1` if no such iterator is found.
|
| 288 |
|
|
@@ -306,11 +354,11 @@ template<class ForwardIterator, class Size, class T,
|
|
| 306 |
type ([[conv.integral]], [[class.conv]]).
|
| 307 |
|
| 308 |
*Effects:* Finds a subsequence of equal values in a sequence.
|
| 309 |
|
| 310 |
*Returns:* The first iterator `i` in the range \[`first`, `last-count`)
|
| 311 |
-
such that for
|
| 312 |
following corresponding conditions hold:
|
| 313 |
`*(i + n) == value, pred(*(i + n),value) != false`. Returns `last` if no
|
| 314 |
such iterator is found.
|
| 315 |
|
| 316 |
*Complexity:* At most `last - first` applications of the corresponding
|
|
|
|
| 103 |
```
|
| 104 |
|
| 105 |
*Effects:* Finds a subsequence of equal values in a sequence.
|
| 106 |
|
| 107 |
*Returns:* The last iterator `i` in the range \[`first1`,
|
| 108 |
+
`last1 - (last2 - first2)`) such that for every non-negative integer
|
| 109 |
`n < (last2 - first2)`, the following corresponding conditions hold:
|
| 110 |
`*(i + n) == *(first2 + n), pred(*(i + n), *(first2 + n)) != false`.
|
| 111 |
Returns `last1` if \[`first2`, `last2`) is empty or if no such iterator
|
| 112 |
is found.
|
| 113 |
|
|
|
|
| 192 |
template<class InputIterator1, class InputIterator2,
|
| 193 |
class BinaryPredicate>
|
| 194 |
pair<InputIterator1, InputIterator2>
|
| 195 |
mismatch(InputIterator1 first1, InputIterator1 last1,
|
| 196 |
InputIterator2 first2, BinaryPredicate pred);
|
| 197 |
+
|
| 198 |
+
template<class InputIterator1, class InputIterator2>
|
| 199 |
+
pair<InputIterator1, InputIterator2>
|
| 200 |
+
mismatch(InputIterator1 first1, InputIterator1 last1,
|
| 201 |
+
InputIterator2 first2, InputIterator2 last2);
|
| 202 |
+
|
| 203 |
+
template <class InputIterator1, class InputIterator2,
|
| 204 |
+
class BinaryPredicate>
|
| 205 |
+
pair<InputIterator1, InputIterator2>
|
| 206 |
+
mismatch(InputIterator1 first1, InputIterator1 last1,
|
| 207 |
+
InputIterator2 first2, InputIterator2 last2,
|
| 208 |
+
BinaryPredicate pred);
|
| 209 |
```
|
| 210 |
|
| 211 |
+
*Remarks:* If `last2` was not given in the argument list, it denotes
|
| 212 |
+
`first2 + (last1 - first1)` below.
|
| 213 |
+
|
| 214 |
*Returns:* A pair of iterators `i` and `j` such that
|
| 215 |
`j == first2 + (i - first1)` and `i` is the first iterator in the range
|
| 216 |
\[`first1`, `last1`) for which the following corresponding conditions
|
| 217 |
hold:
|
| 218 |
|
| 219 |
+
- `j` is in the range `[first2, last2)`.
|
| 220 |
+
- `!(*i == *(first2 + (i - first1)))`
|
| 221 |
+
- `pred(*i, *(first2 + (i - first1))) == false`
|
|
|
|
| 222 |
|
| 223 |
+
Returns the pair `first1 + min(last1 - first1, last2 - first2)` and
|
| 224 |
+
`first2 + min(last1 - first1, last2 - first2)` if such an iterator `i`
|
| 225 |
+
is not found.
|
| 226 |
|
| 227 |
*Complexity:* At most `last1 - first1` applications of the corresponding
|
| 228 |
predicate.
|
| 229 |
|
| 230 |
### Equal <a id="alg.equal">[[alg.equal]]</a>
|
|
|
|
| 236 |
|
| 237 |
template<class InputIterator1, class InputIterator2,
|
| 238 |
class BinaryPredicate>
|
| 239 |
bool equal(InputIterator1 first1, InputIterator1 last1,
|
| 240 |
InputIterator2 first2, BinaryPredicate pred);
|
| 241 |
+
|
| 242 |
+
template<class InputIterator1, class InputIterator2>
|
| 243 |
+
bool equal(InputIterator1 first1, InputIterator1 last1,
|
| 244 |
+
InputIterator2 first2, InputIterator2 last2);
|
| 245 |
+
|
| 246 |
+
template<class InputIterator1, class InputIterator2,
|
| 247 |
+
class BinaryPredicate>
|
| 248 |
+
bool equal(InputIterator1 first1, InputIterator1 last1,
|
| 249 |
+
InputIterator2 first2, InputIterator2 last2,
|
| 250 |
+
BinaryPredicate pred);
|
| 251 |
```
|
| 252 |
|
| 253 |
+
*Remarks:* If `last2` was not given in the argument list, it denotes
|
| 254 |
+
`first2 + (last1 - first1)` below.
|
| 255 |
+
|
| 256 |
+
*Returns:* If `last1 - first1 != last2 - first2`, return `false`.
|
| 257 |
+
Otherwise return `true` if for every iterator `i` in the range
|
| 258 |
+
\[`first1`, `last1`) the following corresponding conditions hold:
|
| 259 |
`*i == *(first2 + (i - first1)), pred(*i, *(first2 + (i - first1))) != false`.
|
| 260 |
Otherwise, returns `false`.
|
| 261 |
|
| 262 |
+
*Complexity:* No applications of the corresponding predicate if
|
| 263 |
+
`InputIterator1` and `InputIterator2` meet the requirements of random
|
| 264 |
+
access iterators and `last1 - first1 != last2 - first2`. Otherwise, at
|
| 265 |
+
most `min(last1 - first1, last2 - first2)` applications of the
|
| 266 |
+
corresponding predicate.
|
| 267 |
|
| 268 |
### Is permutation <a id="alg.is_permutation">[[alg.is_permutation]]</a>
|
| 269 |
|
| 270 |
``` cpp
|
| 271 |
template<class ForwardIterator1, class ForwardIterator2>
|
|
|
|
| 273 |
ForwardIterator2 first2);
|
| 274 |
template<class ForwardIterator1, class ForwardIterator2,
|
| 275 |
class BinaryPredicate>
|
| 276 |
bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 277 |
ForwardIterator2 first2, BinaryPredicate pred);
|
| 278 |
+
template<class ForwardIterator1, class ForwardIterator2>
|
| 279 |
+
bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 280 |
+
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 281 |
+
template<class ForwardIterator1, class ForwardIterator2,
|
| 282 |
+
class BinaryPredicate>
|
| 283 |
+
bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
|
| 284 |
+
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 285 |
+
BinaryPredicate pred);
|
| 286 |
```
|
| 287 |
|
| 288 |
+
*Requires:* `ForwardIterator1` and `ForwardIterator2` shall have the
|
| 289 |
same value type. The comparison function shall be an equivalence
|
| 290 |
relation.
|
| 291 |
|
| 292 |
+
*Remarks:* If `last2` was not given in the argument list, it denotes
|
| 293 |
+
`first2 + (last1 - first1)` below.
|
| 294 |
+
|
| 295 |
+
*Returns:* If `last1 - first1 != last2 - first2`, return `false`.
|
| 296 |
+
Otherwise return `true` if there exists a permutation of the elements in
|
| 297 |
+
the range \[`first2`, `first2 + (last1 - first1)`), beginning with
|
| 298 |
`ForwardIterator2 begin`, such that `equal(first1, last1, begin)`
|
| 299 |
returns `true` or `equal(first1, last1, begin, pred)` returns `true`;
|
| 300 |
otherwise, returns `false`.
|
| 301 |
|
| 302 |
+
*Complexity:* No applications of the corresponding predicate if
|
| 303 |
+
`ForwardIterator1` and `ForwardIterator2` meet the requirements of
|
| 304 |
+
random access iterators and `last1 - first1 != last2 - first2`.
|
| 305 |
+
Otherwise, exactly `distance(first1, last1)` applications of the
|
| 306 |
+
corresponding predicate if `equal(first1, last1, first2, last2)` would
|
| 307 |
+
return `true` if `pred` was not given in the argument list or
|
| 308 |
+
`equal(first1, last1, first2, last2, pred)` would return `true` if pred
|
| 309 |
+
was given in the argument list; otherwise, at worst 𝑂(N^2), where N has
|
| 310 |
+
the value `distance(first1, last1)`.
|
| 311 |
|
| 312 |
### Search <a id="alg.search">[[alg.search]]</a>
|
| 313 |
|
| 314 |
``` cpp
|
| 315 |
template<class ForwardIterator1, class ForwardIterator2>
|
|
|
|
| 326 |
```
|
| 327 |
|
| 328 |
*Effects:* Finds a subsequence of equal values in a sequence.
|
| 329 |
|
| 330 |
*Returns:* The first iterator `i` in the range \[`first1`,
|
| 331 |
+
`last1 - (last2-first2)`) such that for every non-negative integer `n`
|
| 332 |
less than `last2 - first2` the following corresponding conditions hold:
|
| 333 |
`*(i + n) == *(first2 + n), pred(*(i + n), *(first2 + n)) != false`.
|
| 334 |
Returns `first1` if \[`first2`, `last2`) is empty, otherwise returns
|
| 335 |
`last1` if no such iterator is found.
|
| 336 |
|
|
|
|
| 354 |
type ([[conv.integral]], [[class.conv]]).
|
| 355 |
|
| 356 |
*Effects:* Finds a subsequence of equal values in a sequence.
|
| 357 |
|
| 358 |
*Returns:* The first iterator `i` in the range \[`first`, `last-count`)
|
| 359 |
+
such that for every non-negative integer `n` less than `count` the
|
| 360 |
following corresponding conditions hold:
|
| 361 |
`*(i + n) == value, pred(*(i + n),value) != false`. Returns `last` if no
|
| 362 |
such iterator is found.
|
| 363 |
|
| 364 |
*Complexity:* At most `last - first` applications of the corresponding
|