<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 4, 2019, 8:43 AM Marc Mutz via Std-Proposals &lt;<a href="mailto:std-proposals@lists.isocpp.org">std-proposals@lists.isocpp.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I&#39;ve been telling everyone who (didn&#39;t) want to know that std::for_each <br>
is only ever useful for its (very recent) parallelisation capabilities. <br>
That&#39;s because for_each is devoid of semantics. What does the thing do? <br>
Does it follow SGI STL rules and just inspects the elements in turn, or <br>
does it take advantage of the leeway that <br>
<a href="http://eel.is/c++draft/alg.foreach#2" rel="noreferrer noreferrer" target="_blank">http://eel.is/c++draft/alg.foreach#2</a>  gave and actually applies an <br>
action to the element? For_each, after all, is still officially a <br>
&quot;non-modifying sequence algorithm&quot;, and it&#39;s odd that it should be able <br>
to modify elements.<br>
<br>
I&#39;ve also been telling everyone who (didn&#39;t) want to know that they can <br>
just write their own inplace_transform, which behaves in all respects <br>
like std::for_each, except for the name.<br>
<br>
We can&#39;t roll back on <a href="http://eel.is/c++draft/alg.foreach#2" rel="noreferrer noreferrer" target="_blank">http://eel.is/c++draft/alg.foreach#2</a>, but by <br>
providing inplace_transform, we can at least prepare for a future <br>
algorithm vocabulary in which for_each can again no longer modify the <br>
sequence.<br>
<br>
Thoughts?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Just my opinion but I&#39;d say that any algorithm extensions suhould build on top of ranges (composibility) and that current algorithms should be left as they are.</div><div dir="auto"><br></div><div dir="auto">As for your suggestion I&#39;m almost certain that ranges already have this capability.</div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Domen</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>

