tmp/tmpeytr5xeg/{from.md → to.md}
RENAMED
|
@@ -3,40 +3,57 @@
|
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator1, class InputIterator2>
|
| 5 |
bool
|
| 6 |
lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
|
| 7 |
InputIterator2 first2, InputIterator2 last2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
template<class InputIterator1, class InputIterator2, class Compare>
|
| 10 |
bool
|
| 11 |
lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
|
| 12 |
InputIterator2 first2, InputIterator2 last2,
|
| 13 |
Compare comp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
```
|
| 15 |
|
| 16 |
*Returns:* `true` if the sequence of elements defined by the range
|
| 17 |
\[`first1`, `last1`) is lexicographically less than the sequence of
|
| 18 |
elements defined by the range \[`first2`, `last2`) and `false`
|
| 19 |
otherwise.
|
| 20 |
|
| 21 |
-
*Complexity:* At most
|
| 22 |
applications of the corresponding comparison.
|
| 23 |
|
| 24 |
*Remarks:* If two sequences have the same number of elements and their
|
| 25 |
-
corresponding elements are equivalent, then neither sequence is
|
| 26 |
lexicographically less than the other. If one sequence is a prefix of
|
| 27 |
the other, then the shorter sequence is lexicographically less than the
|
| 28 |
longer sequence. Otherwise, the lexicographical comparison of the
|
| 29 |
sequences yields the same result as the comparison of the first
|
| 30 |
corresponding pair of elements that are not equivalent.
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
``` cpp
|
| 33 |
-
for ( ; first1 != last1 && first2 != last2 ; ++first1, ++first2) {
|
| 34 |
if (*first1 < *first2) return true;
|
| 35 |
if (*first2 < *first1) return false;
|
| 36 |
}
|
| 37 |
return first1 == last1 && first2 != last2;
|
| 38 |
```
|
| 39 |
|
| 40 |
-
*
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
|
|
|
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator1, class InputIterator2>
|
| 5 |
bool
|
| 6 |
lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
|
| 7 |
InputIterator2 first2, InputIterator2 last2);
|
| 8 |
+
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 9 |
+
bool
|
| 10 |
+
lexicographical_compare(ExecutionPolicy&& exec,
|
| 11 |
+
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 12 |
+
ForwardIterator2 first2, ForwardIterator2 last2);
|
| 13 |
|
| 14 |
template<class InputIterator1, class InputIterator2, class Compare>
|
| 15 |
bool
|
| 16 |
lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
|
| 17 |
InputIterator2 first2, InputIterator2 last2,
|
| 18 |
Compare comp);
|
| 19 |
+
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2, class Compare>
|
| 20 |
+
bool
|
| 21 |
+
lexicographical_compare(ExecutionPolicy&& exec,
|
| 22 |
+
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 23 |
+
ForwardIterator2 first2, ForwardIterator2 last2,
|
| 24 |
+
Compare comp);
|
| 25 |
```
|
| 26 |
|
| 27 |
*Returns:* `true` if the sequence of elements defined by the range
|
| 28 |
\[`first1`, `last1`) is lexicographically less than the sequence of
|
| 29 |
elements defined by the range \[`first2`, `last2`) and `false`
|
| 30 |
otherwise.
|
| 31 |
|
| 32 |
+
*Complexity:* At most 2 min(`last1 - first1`, `last2 - first2`)
|
| 33 |
applications of the corresponding comparison.
|
| 34 |
|
| 35 |
*Remarks:* If two sequences have the same number of elements and their
|
| 36 |
+
corresponding elements (if any) are equivalent, then neither sequence is
|
| 37 |
lexicographically less than the other. If one sequence is a prefix of
|
| 38 |
the other, then the shorter sequence is lexicographically less than the
|
| 39 |
longer sequence. Otherwise, the lexicographical comparison of the
|
| 40 |
sequences yields the same result as the comparison of the first
|
| 41 |
corresponding pair of elements that are not equivalent.
|
| 42 |
|
| 43 |
+
[*Example 1*:
|
| 44 |
+
|
| 45 |
+
The following sample implementation satisfies these requirements:
|
| 46 |
+
|
| 47 |
``` cpp
|
| 48 |
+
for ( ; first1 != last1 && first2 != last2 ; ++first1, (void) ++first2) {
|
| 49 |
if (*first1 < *first2) return true;
|
| 50 |
if (*first2 < *first1) return false;
|
| 51 |
}
|
| 52 |
return first1 == last1 && first2 != last2;
|
| 53 |
```
|
| 54 |
|
| 55 |
+
— *end example*]
|
| 56 |
+
|
| 57 |
+
[*Note 1*: An empty sequence is lexicographically less than any
|
| 58 |
+
non-empty sequence, but not less than any empty sequence. — *end note*]
|
| 59 |
|