Skip to content

Commit 2a9aa98

Browse files
burblebeetkoeppe
authored andcommitted
LWG4242 ranges::distance does not work with volatile iterators
1 parent 42ec426 commit 2a9aa98

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/iterators.tex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3068,7 +3068,13 @@
30683068
\begin{itemdescr}
30693069
\pnum
30703070
\effects
3071-
Equivalent to: \tcode{return last - static_cast<const decay_t<I>\&>(first);}
3071+
Equivalent to:
3072+
\begin{codeblock}
3073+
if constexpr (!is_array_v<remove_reference_t<I>>)
3074+
return last - first;
3075+
else
3076+
return last - static_cast<decay_t<I>>(first);
3077+
\end{codeblock}
30723078
\end{itemdescr}
30733079

30743080
\indexlibraryglobal{distance}%

0 commit comments

Comments
 (0)