From Jason Turner

[alg.three.way]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpc7_goouo/{from.md → to.md} +7 -10
tmp/tmpc7_goouo/{from.md → to.md} RENAMED
@@ -7,23 +7,20 @@ template<class InputIterator1, class InputIterator2, class Cmp>
7
  InputIterator2 b2, InputIterator2 e2,
8
  Cmp comp)
9
  -> decltype(comp(*b1, *b2));
10
  ```
11
 
 
 
 
12
  *Mandates:* `decltype(comp(*b1, *b2))` is a comparison category type.
13
 
14
- *Effects:* Lexicographically compares two ranges and produces a result
15
- of the strongest applicable comparison category type. Equivalent to:
 
16
 
17
- ``` cpp
18
- for ( ; b1 != e1 && b2 != e2; void(++b1), void(++b2) )
19
- if (auto cmp = comp(*b1,*b2); cmp != 0)
20
- return cmp;
21
- return b1 != e1 ? strong_ordering::greater :
22
- b2 != e2 ? strong_ordering::less :
23
- strong_ordering::equal;
24
- ```
25
 
26
  ``` cpp
27
  template<class InputIterator1, class InputIterator2>
28
  constexpr auto
29
  lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,
 
7
  InputIterator2 b2, InputIterator2 e2,
8
  Cmp comp)
9
  -> decltype(comp(*b1, *b2));
10
  ```
11
 
12
+ Let N be min(`e1 - b1`, `e2 - b2`). Let E(n) be
13
+ `comp(*(b1 + `n`), *(b2 + `n`))`.
14
+
15
  *Mandates:* `decltype(comp(*b1, *b2))` is a comparison category type.
16
 
17
+ *Returns:* E(i), where i is the smallest integer in \[`0`, N) such that
18
+ E(i)` != 0` is `true`, or `(e1 - b1) <=> (e2 - b2)` if no such integer
19
+ exists.
20
 
21
+ *Complexity:* At most N applications of `comp`.
 
 
 
 
 
 
 
22
 
23
  ``` cpp
24
  template<class InputIterator1, class InputIterator2>
25
  constexpr auto
26
  lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,