From Jason Turner

[string.view.ops]

Diff to HTML by rtfpessoa

tmp/tmp7gkicgbs/{from.md → to.md} RENAMED
@@ -16,10 +16,11 @@ Let `rlen` be the smaller of `n` and `size() - pos`.
16
 
17
  *Complexity:* 𝑂(`rlen`).
18
 
19
  ``` cpp
20
  constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
 
21
  ```
22
 
23
  Let `rlen` be the smaller of `n` and `size() - pos`.
24
 
25
  *Effects:* Determines `rlen`, the effective length of the string to
@@ -90,11 +91,13 @@ constexpr int compare(size_type pos1, size_type n1, const charT* s, size_type n2
90
 
91
  ``` cpp
92
  constexpr bool starts_with(basic_string_view x) const noexcept;
93
  ```
94
 
95
- *Effects:* Equivalent to: `return substr(0, x.size()) == x;`
 
 
96
 
97
  ``` cpp
98
  constexpr bool starts_with(charT x) const noexcept;
99
  ```
100
 
@@ -108,14 +111,16 @@ constexpr bool starts_with(const charT* x) const;
108
 
109
  ``` cpp
110
  constexpr bool ends_with(basic_string_view x) const noexcept;
111
  ```
112
 
 
 
113
  *Effects:* Equivalent to:
114
 
115
  ``` cpp
116
- return size() >= x.size() && compare(size() - x.size(), npos, x) == 0;
117
  ```
118
 
119
  ``` cpp
120
  constexpr bool ends_with(charT x) const noexcept;
121
  ```
 
16
 
17
  *Complexity:* 𝑂(`rlen`).
18
 
19
  ``` cpp
20
  constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
21
+ constexpr basic_string_view subview(size_type pos = 0, size_type n = npos) const;
22
  ```
23
 
24
  Let `rlen` be the smaller of `n` and `size() - pos`.
25
 
26
  *Effects:* Determines `rlen`, the effective length of the string to
 
91
 
92
  ``` cpp
93
  constexpr bool starts_with(basic_string_view x) const noexcept;
94
  ```
95
 
96
+ Let `rlen` be the smaller of `size()` and `x.size()`.
97
+
98
+ *Effects:* Equivalent to: `return basic_string_view(data(), rlen) == x;`
99
 
100
  ``` cpp
101
  constexpr bool starts_with(charT x) const noexcept;
102
  ```
103
 
 
111
 
112
  ``` cpp
113
  constexpr bool ends_with(basic_string_view x) const noexcept;
114
  ```
115
 
116
+ Let `rlen` be the smaller of `size()` and `x.size()`.
117
+
118
  *Effects:* Equivalent to:
119
 
120
  ``` cpp
121
+ return basic_string_view(data() + (size() - rlen), rlen) == x;
122
  ```
123
 
124
  ``` cpp
125
  constexpr bool ends_with(charT x) const noexcept;
126
  ```