Skip to content

Commit 26d6895

Browse files
committed
[re.alg.replace] Add whitespace and bullets to make this paragraph more
readable and disambiguate the binding of the "Then calls" clause in the third sentence. Fixes #279.
1 parent 0736e04 commit 26d6895

File tree

1 file changed

+37
-13
lines changed

1 file changed

+37
-13
lines changed

source/regex.tex

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3494,22 +3494,46 @@
34943494
\pnum
34953495
\indexlibrary{\idxcode{format_no_copy}}%
34963496
\indexlibrary{\idxcode{format_first_only}}%
3497-
\effects Constructs a \tcode{regex_iterator} object \tcode{i}
3498-
as if by \tcode{regex_iterator<BidirectionalIterator, charT, traits>
3499-
i(first, last, e, flags)}, and uses \tcode{i} to enumerate through all
3497+
\effects
3498+
Constructs a \tcode{regex_iterator} object \tcode{i}
3499+
as if by
3500+
\begin{codeblock}
3501+
regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags)
3502+
\end{codeblock}
3503+
and uses \tcode{i} to enumerate through all
35003504
of the matches \tcode{m} of type \tcode{match_results<BidirectionalIterator>}
3501-
that occur within the sequence \range{first}{last}. If no such
3505+
that occur within the sequence \range{first}{last}.
3506+
If no such
35023507
matches are found and \tcode{!(flags \&
3503-
regex_constants \colcol format_no_copy)} then calls \tcode{out = std::copy(first,
3504-
last, out)}. If any matches are found then, for each such match,
3505-
if \tcode{!(flags \& regex_constants::format_no_copy)}, calls
3506-
\tcode{out = std\colcol{}copy(m.prefix().first, m.prefix().second, \brk{}out)}, and
3507-
then calls \tcode{out = m.format(out, fmt, flags)}
3508+
regex_constants::format_no_copy)} then calls
3509+
\begin{codeblock}
3510+
out = std::copy(first, last, out)
3511+
\end{codeblock}
3512+
If any matches are found then, for each such match:
3513+
\begin{itemize}
3514+
\item
3515+
If \tcode{!(flags \& regex_constants::format_no_copy)}, calls
3516+
\begin{codeblock}
3517+
out = std::copy(m.prefix().first, m.prefix().second, out)
3518+
\end{codeblock}
3519+
\item
3520+
Then calls
3521+
\begin{codeblock}
3522+
out = m.format(out, fmt, flags)
3523+
\end{codeblock}
35083524
for the first form of the function and
3509-
\tcode{out = m.format(out,} \tcode{fmt, fmt + char_traits<charT>::length(fmt), flags)} for the second. Finally, if such a match
3510-
is found and \tcode{!(flags \& regex_constants \colcol format_no_copy)},
3511-
calls \tcode{out = std::\brk{}copy(last_m.suffix().first, last_m.suffix().second,
3512-
out)} where \tcode{last_m} is a copy of the last match
3525+
\begin{codeblock}
3526+
out = m.format(out, fmt, fmt + char_traits<charT>::length(fmt), flags)
3527+
\end{codeblock}
3528+
for the second.
3529+
\end{itemize}
3530+
Finally, if such a match
3531+
is found and \tcode{!(flags \& regex_constants::format_no_copy)},
3532+
calls
3533+
\begin{codeblock}
3534+
out = std::copy(last_m.suffix().first, last_m.suffix().second, out)
3535+
\end{codeblock}
3536+
where \tcode{last_m} is a copy of the last match
35133537
found. If \tcode{flags \& regex_constants::format_first_only}
35143538
is non-zero then only the first match found is replaced.
35153539

0 commit comments

Comments
 (0)