Skip to content

Commit 0ab7d56

Browse files
authored
[range.split.overview] Improve string splitting example
With the adoption of P1989R2, `string_view` is constructible from `subrange`. We can use that to simplify the example of string splitting. From pull request #4714.
1 parent 7d7ddcd commit 0ab7d56

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

source/ranges.tex

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6192,10 +6192,8 @@
61926192
\begin{example}
61936193
\begin{codeblock}
61946194
string str{"the quick brown fox"};
6195-
for (span<char const> word : split(str, ' ')) {
6196-
for (char ch : word)
6197-
cout << ch;
6198-
cout << '*';
6195+
for (string_view word : split(str, ' ')) {
6196+
cout << word << '*';
61996197
}
62006198
// The above prints: the*quick*brown*fox*
62016199
\end{codeblock}

0 commit comments

Comments
 (0)