Skip to content

Commit 007738a

Browse files
committed
[execpol] Move [execpol] to the end of subclause [algorithms.parallel]
Part of the C++26 clause restructuring (#5315).
1 parent ff96113 commit 007738a

File tree

2 files changed

+167
-166
lines changed

2 files changed

+167
-166
lines changed

source/algorithms.tex

+167
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,173 @@
620620
Parallel algorithms shall not participate in overload resolution unless
621621
\tcode{is_execution_policy_v<remove_cvref_t<ExecutionPolicy>>} is \tcode{true}.
622622

623+
\rSec2[execpol]{Execution policies}
624+
625+
\rSec3[execpol.general]{General}
626+
627+
\pnum
628+
Subclause~\ref{execpol} describes classes that are \defn{execution policy} types. An
629+
object of an execution policy type indicates the kinds of parallelism allowed
630+
in the execution of an algorithm and expresses the consequent requirements on
631+
the element access functions.
632+
Execution policy types are declared in header \libheaderref{execution}.
633+
\begin{example}
634+
\begin{codeblock}
635+
using namespace std;
636+
vector<int> v = @\commentellip@;
637+
638+
// standard sequential sort
639+
sort(v.begin(), v.end());
640+
641+
// explicitly sequential sort
642+
sort(execution::seq, v.begin(), v.end());
643+
644+
// permitting parallel execution
645+
sort(execution::par, v.begin(), v.end());
646+
647+
// permitting vectorization as well
648+
sort(execution::par_unseq, v.begin(), v.end());
649+
\end{codeblock}
650+
\end{example}
651+
\begin{note}
652+
Implementations can provide additional execution policies
653+
to those described in this document as extensions
654+
to address parallel architectures that require idiosyncratic
655+
parameters for efficient execution.
656+
\end{note}
657+
658+
\rSec3[execpol.type]{Execution policy type trait}
659+
660+
\indexlibraryglobal{is_execution_policy}%
661+
\begin{itemdecl}
662+
template<class T> struct is_execution_policy { @\seebelow@ };
663+
\end{itemdecl}
664+
665+
\begin{itemdescr}
666+
\pnum
667+
\tcode{is_execution_policy} can be used to detect execution policies for the
668+
purpose of excluding function signatures from otherwise ambiguous overload
669+
resolution participation.
670+
671+
\pnum
672+
\tcode{is_execution_policy<T>} is a \oldconcept{UnaryTypeTrait} with a
673+
base characteristic of \tcode{true_type} if \tcode{T} is the type of a standard
674+
or \impldef{additional execution policies supported by parallel algorithms}
675+
execution policy, otherwise \tcode{false_type}.
676+
677+
\begin{note}
678+
This provision reserves the privilege of creating non-standard execution
679+
policies to the library implementation.
680+
\end{note}
681+
682+
\pnum
683+
The behavior of a program that adds specializations for
684+
\tcode{is_execution_policy} is undefined.
685+
\end{itemdescr}
686+
687+
\rSec3[execpol.seq]{Sequenced execution policy}
688+
689+
\indexlibraryglobal{execution::sequenced_policy}%
690+
\begin{itemdecl}
691+
class execution::sequenced_policy { @\unspec@ };
692+
\end{itemdecl}
693+
694+
\begin{itemdescr}
695+
\pnum
696+
The class \tcode{execution::sequenced_policy} is an execution policy type used
697+
as a unique type to disambiguate parallel algorithm overloading and require
698+
that a parallel algorithm's execution may not be parallelized.
699+
700+
\pnum
701+
During the execution of a parallel algorithm with
702+
the \tcode{execution::sequenced_policy} policy,
703+
if the invocation of an element access function exits via an exception,
704+
\tcode{terminate} is invoked\iref{except.terminate}.
705+
\end{itemdescr}
706+
707+
\rSec3[execpol.par]{Parallel execution policy}
708+
709+
\indexlibraryglobal{execution::parallel_policy}%
710+
\begin{itemdecl}
711+
class execution::parallel_policy { @\unspec@ };
712+
\end{itemdecl}
713+
714+
\begin{itemdescr}
715+
\pnum
716+
The class \tcode{execution::parallel_policy} is an execution policy type used as
717+
a unique type to disambiguate parallel algorithm overloading and indicate that
718+
a parallel algorithm's execution may be parallelized.
719+
720+
\pnum
721+
During the execution of a parallel algorithm with
722+
the \tcode{execution::parallel_policy} policy,
723+
if the invocation of an element access function exits via an exception,
724+
\tcode{terminate} is invoked\iref{except.terminate}.
725+
\end{itemdescr}
726+
727+
\rSec3[execpol.parunseq]{Parallel and unsequenced execution policy}
728+
729+
\indexlibraryglobal{execution::parallel_unsequenced_policy}%
730+
\begin{itemdecl}
731+
class execution::parallel_unsequenced_policy { @\unspec@ };
732+
\end{itemdecl}
733+
734+
\begin{itemdescr}
735+
\pnum
736+
The class \tcode{execution::parallel_unsequenced_policy} is an execution policy type
737+
used as a unique type to disambiguate parallel algorithm overloading and
738+
indicate that a parallel algorithm's execution may be parallelized and
739+
vectorized.
740+
741+
\pnum
742+
During the execution of a parallel algorithm with
743+
the \tcode{execution::parallel_unsequenced_policy} policy,
744+
if the invocation of an element access function exits via an exception,
745+
\tcode{terminate} is invoked\iref{except.terminate}.
746+
\end{itemdescr}
747+
748+
\rSec3[execpol.unseq]{Unsequenced execution policy}
749+
750+
\indexlibraryglobal{execution::unsequenced_policy}%
751+
\begin{itemdecl}
752+
class execution::unsequenced_policy { @\unspec@ };
753+
\end{itemdecl}
754+
755+
\begin{itemdescr}
756+
\pnum
757+
The class \tcode{unsequenced_policy} is an execution policy type
758+
used as a unique type to disambiguate parallel algorithm overloading and
759+
indicate that a parallel algorithm's execution may be vectorized,
760+
e.g., executed on a single thread using instructions
761+
that operate on multiple data items.
762+
763+
\pnum
764+
During the execution of a parallel algorithm with
765+
the \tcode{execution::unsequenced_policy} policy,
766+
if the invocation of an element access function exits via an exception,
767+
\tcode{terminate} is invoked\iref{except.terminate}.
768+
\end{itemdescr}
769+
770+
\rSec3[execpol.objects]{Execution policy objects}
771+
772+
\indexlibraryglobal{seq}%
773+
\indexlibraryglobal{par}%
774+
\indexlibraryglobal{par_unseq}%
775+
\indexlibrarymember{execution}{seq}%
776+
\indexlibrarymember{execution}{par}%
777+
\indexlibrarymember{execution}{par_unseq}%
778+
\begin{itemdecl}
779+
inline constexpr execution::sequenced_policy execution::seq{ @\unspec@ };
780+
inline constexpr execution::parallel_policy execution::par{ @\unspec@ };
781+
inline constexpr execution::parallel_unsequenced_policy execution::par_unseq{ @\unspec@ };
782+
inline constexpr execution::unsequenced_policy execution::unseq{ @\unspec@ };
783+
\end{itemdecl}
784+
785+
\begin{itemdescr}
786+
\pnum
787+
The header \libheaderref{execution} declares global objects associated with each type of execution policy.
788+
\end{itemdescr}
789+
623790
\rSec1[algorithm.syn]{Header \tcode{<algorithm>} synopsis}
624791
\indexheader{algorithm}%
625792

source/utilities.tex

-166
Original file line numberDiff line numberDiff line change
@@ -15217,172 +15217,6 @@
1521715217
\tcode{hash<type_index>()(index)} shall evaluate to the same result as \tcode{index.hash_code()}.
1521815218
\end{itemdescr}
1521915219

15220-
\rSec1[execpol]{Execution policies}
15221-
\rSec2[execpol.general]{General}
15222-
15223-
\pnum
15224-
Subclause~\ref{execpol} describes classes that are \defn{execution policy} types. An
15225-
object of an execution policy type indicates the kinds of parallelism allowed
15226-
in the execution of an algorithm and expresses the consequent requirements on
15227-
the element access functions.
15228-
Execution policy types are declared in header \libheaderref{execution}.
15229-
\begin{example}
15230-
\begin{codeblock}
15231-
using namespace std;
15232-
vector<int> v = @\commentellip@;
15233-
15234-
// standard sequential sort
15235-
sort(v.begin(), v.end());
15236-
15237-
// explicitly sequential sort
15238-
sort(execution::seq, v.begin(), v.end());
15239-
15240-
// permitting parallel execution
15241-
sort(execution::par, v.begin(), v.end());
15242-
15243-
// permitting vectorization as well
15244-
sort(execution::par_unseq, v.begin(), v.end());
15245-
\end{codeblock}
15246-
\end{example}
15247-
\begin{note}
15248-
Implementations can provide additional execution policies
15249-
to those described in this document as extensions
15250-
to address parallel architectures that require idiosyncratic
15251-
parameters for efficient execution.
15252-
\end{note}
15253-
15254-
\rSec2[execpol.type]{Execution policy type trait}
15255-
15256-
\indexlibraryglobal{is_execution_policy}%
15257-
\begin{itemdecl}
15258-
template<class T> struct is_execution_policy { @\seebelow@ };
15259-
\end{itemdecl}
15260-
15261-
\begin{itemdescr}
15262-
\pnum
15263-
\tcode{is_execution_policy} can be used to detect execution policies for the
15264-
purpose of excluding function signatures from otherwise ambiguous overload
15265-
resolution participation.
15266-
15267-
\pnum
15268-
\tcode{is_execution_policy<T>} is a \oldconcept{UnaryTypeTrait} with a
15269-
base characteristic of \tcode{true_type} if \tcode{T} is the type of a standard
15270-
or \impldef{additional execution policies supported by parallel algorithms}
15271-
execution policy, otherwise \tcode{false_type}.
15272-
15273-
\begin{note}
15274-
This provision reserves the privilege of creating non-standard execution
15275-
policies to the library implementation.
15276-
\end{note}
15277-
15278-
\pnum
15279-
The behavior of a program that adds specializations for
15280-
\tcode{is_execution_policy} is undefined.
15281-
\end{itemdescr}
15282-
15283-
\rSec2[execpol.seq]{Sequenced execution policy}
15284-
15285-
\indexlibraryglobal{execution::sequenced_policy}%
15286-
\begin{itemdecl}
15287-
class execution::sequenced_policy { @\unspec@ };
15288-
\end{itemdecl}
15289-
15290-
\begin{itemdescr}
15291-
\pnum
15292-
The class \tcode{execution::sequenced_policy} is an execution policy type used
15293-
as a unique type to disambiguate parallel algorithm overloading and require
15294-
that a parallel algorithm's execution may not be parallelized.
15295-
15296-
\pnum
15297-
During the execution of a parallel algorithm with
15298-
the \tcode{execution::sequenced_policy} policy,
15299-
if the invocation of an element access function exits via an exception,
15300-
\tcode{terminate} is invoked\iref{except.terminate}.
15301-
\end{itemdescr}
15302-
15303-
\rSec2[execpol.par]{Parallel execution policy}
15304-
15305-
\indexlibraryglobal{execution::parallel_policy}%
15306-
\begin{itemdecl}
15307-
class execution::parallel_policy { @\unspec@ };
15308-
\end{itemdecl}
15309-
15310-
\begin{itemdescr}
15311-
\pnum
15312-
The class \tcode{execution::parallel_policy} is an execution policy type used as
15313-
a unique type to disambiguate parallel algorithm overloading and indicate that
15314-
a parallel algorithm's execution may be parallelized.
15315-
15316-
\pnum
15317-
During the execution of a parallel algorithm with
15318-
the \tcode{execution::parallel_policy} policy,
15319-
if the invocation of an element access function exits via an exception,
15320-
\tcode{terminate} is invoked\iref{except.terminate}.
15321-
\end{itemdescr}
15322-
15323-
\rSec2[execpol.parunseq]{Parallel and unsequenced execution policy}
15324-
15325-
\indexlibraryglobal{execution::parallel_unsequenced_policy}%
15326-
\begin{itemdecl}
15327-
class execution::parallel_unsequenced_policy { @\unspec@ };
15328-
\end{itemdecl}
15329-
15330-
\begin{itemdescr}
15331-
\pnum
15332-
The class \tcode{execution::parallel_unsequenced_policy} is an execution policy type
15333-
used as a unique type to disambiguate parallel algorithm overloading and
15334-
indicate that a parallel algorithm's execution may be parallelized and
15335-
vectorized.
15336-
15337-
\pnum
15338-
During the execution of a parallel algorithm with
15339-
the \tcode{execution::parallel_unsequenced_policy} policy,
15340-
if the invocation of an element access function exits via an exception,
15341-
\tcode{terminate} is invoked\iref{except.terminate}.
15342-
\end{itemdescr}
15343-
15344-
\rSec2[execpol.unseq]{Unsequenced execution policy}
15345-
15346-
\indexlibraryglobal{execution::unsequenced_policy}%
15347-
\begin{itemdecl}
15348-
class execution::unsequenced_policy { @\unspec@ };
15349-
\end{itemdecl}
15350-
15351-
\begin{itemdescr}
15352-
\pnum
15353-
The class \tcode{unsequenced_policy} is an execution policy type
15354-
used as a unique type to disambiguate parallel algorithm overloading and
15355-
indicate that a parallel algorithm's execution may be vectorized,
15356-
e.g., executed on a single thread using instructions
15357-
that operate on multiple data items.
15358-
15359-
\pnum
15360-
During the execution of a parallel algorithm with
15361-
the \tcode{execution::unsequenced_policy} policy,
15362-
if the invocation of an element access function exits via an exception,
15363-
\tcode{terminate} is invoked\iref{except.terminate}.
15364-
\end{itemdescr}
15365-
15366-
\rSec2[execpol.objects]{Execution policy objects}
15367-
15368-
\indexlibraryglobal{seq}%
15369-
\indexlibraryglobal{par}%
15370-
\indexlibraryglobal{par_unseq}%
15371-
\indexlibrarymember{execution}{seq}%
15372-
\indexlibrarymember{execution}{par}%
15373-
\indexlibrarymember{execution}{par_unseq}%
15374-
\begin{itemdecl}
15375-
inline constexpr execution::sequenced_policy execution::seq{ @\unspec@ };
15376-
inline constexpr execution::parallel_policy execution::par{ @\unspec@ };
15377-
inline constexpr execution::parallel_unsequenced_policy execution::par_unseq{ @\unspec@ };
15378-
inline constexpr execution::unsequenced_policy execution::unseq{ @\unspec@ };
15379-
\end{itemdecl}
15380-
15381-
\begin{itemdescr}
15382-
\pnum
15383-
The header \libheaderref{execution} declares global objects associated with each type of execution policy.
15384-
\end{itemdescr}
15385-
1538615220
\rSec1[charconv]{Primitive numeric conversions}
1538715221

1538815222
\rSec2[charconv.syn]{Header \tcode{<charconv>} synopsis}

0 commit comments

Comments
 (0)