Skip to content

Commit 7a2dafa

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

File tree

2 files changed

+171
-171
lines changed

2 files changed

+171
-171
lines changed

source/algorithms.tex

+171-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717

1818
\begin{libsumtab}{Algorithms library summary}{algorithms.summary}
1919
\ref{algorithms.requirements} & Algorithms requirements & \\
20-
\ref{algorithms.parallel} & Parallel algorithms & \\ \rowsep
21-
\ref{algorithms.results} & Algorithm result types & \tcode{<algorithm>} \\
20+
\ref{algorithms.parallel} & Parallel algorithms & \tcode{<execution>} \\ \rowsep
21+
\ref{algorithms.results} & Algorithm result types & \tcode{<algorithm>} \\
2222
\ref{alg.nonmodifying} & Non-modifying sequence operations & \\
2323
\ref{alg.modifying.operations} & Mutating sequence operations & \\
2424
\ref{alg.sorting} & Sorting and related operations & \\ \rowsep
25-
\ref{numeric.ops} & Generalized numeric operations & \tcode{<numeric>} \\ \rowsep
25+
\ref{numeric.ops} & Generalized numeric operations & \tcode{<numeric>} \\ \rowsep
2626
\ref{specialized.algorithms} & Specialized \tcode{<memory>} algorithms & \tcode{<memory>} \\ \rowsep
2727
\ref{alg.rand} & Specialized \tcode{<random>} algorithms & \tcode{<random>} \\ \rowsep
28-
\ref{alg.c.library} & C library algorithms & \tcode{<cstdlib>} \\
28+
\ref{alg.c.library} & C library algorithms & \tcode{<cstdlib>} \\
2929
\end{libsumtab}
3030

3131
\rSec1[algorithms.requirements]{Algorithms requirements}
@@ -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

-167
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
\ref{bitset} & Fixed-size sequences of bits & \tcode{<bitset>} \\ \rowsep
2121
\ref{function.objects} & Function objects & \tcode{<functional>} \\ \rowsep
2222
\ref{type.index} & Type indexes & \tcode{<typeindex>} \\ \rowsep
23-
\ref{execpol} & Execution policies & \tcode{<execution>} \\ \rowsep
2423
\ref{charconv} & Primitive numeric conversions & \tcode{<charconv>} \\ \rowsep
2524
\ref{format} & Formatting & \tcode{<format>} \\ \rowsep
2625
\ref{bit} & Bit manipulation & \tcode{<bit>} \\
@@ -15216,172 +15215,6 @@
1521615215
\tcode{hash<type_index>()(index)} shall evaluate to the same result as \tcode{index.hash_code()}.
1521715216
\end{itemdescr}
1521815217

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

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

0 commit comments

Comments
 (0)