What are the constraints on the user using STL's parallel algorithms? : <p>At the Jacksonville meeting the proposal <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0024r2.html" rel="noreferrer">P0024r2</a> effectively adopting the specifications from the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4354.pdf" rel="noreferrer">Parallelism TS</a> was accepted into the <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2016/n4604.pdf" rel="noreferrer">C++17 (draft)</a>. This proposal adds overloads for many of the algorithms taking an <em>execution policy</em> argument to indicate what kind of parallelism should be considered. There are three execution policies already defined in <code>&lt;execution&gt;</code> (20.19.2 [execution]):</p>

<ul>
<li><code>std::execution::sequenced_policy</code> (20.19.4 [execpol.seq]) with a <code>constexpr</code> object <code>std::execution::seq</code> (20.19.7 [parallel.execpol.objects]) to indicate sequential execution similar to calling the algorithms without an execution policy.</li>
<li><code>std::execution::parallel_policy</code> (20.19.5 [execpol.par]) with a <code>constexpr</code> object <code>std::execution::par</code> (20.19.7 [parallel.execpol.objects]) to indicate execution of algorithms potentially using multiple threads.</li>
<li><code>std::execution::parallel_unsequenced_policy</code> (20.19.6 [execpol.vec]) with a <code>constexpr</code> object <code>std::execution::par_unseq</code> (20.19.7 [parallel.execpol.objects])to indicate execution of algorithms potentially using vector execution and/or multiple threads.</li>
</ul>

<p>The STL algorithms generally take user-defined objects (iterators, function objects) as arguments. <strong>What are the constraints on user-defined objects to make them usable with the parallel algorithms using the standard execution policies?</strong></p>

<p>For example, when using an algorithm like in the example below, what are the implications for <code>FwdIt</code> and <code>Predicate</code>?</p>

<pre><code>template &lt;typename FwdIt, typename Predicate&gt;
FwdIt call_remove_if(FwdIt begin, FwdIt end, Predicate predicate) {
    return std::remove_if(std::execution::par, begin, end, predicate);
}
</code></pre>
