@@ -35,10 +35,9 @@ <h1>Effect of execution policies on algorithm execution</h1>
35
35
< p >
36
36
The invocations of element access functions in parallel algorithms invoked with an execution
37
37
policy object of type < code > parallel_execution_policy</ code > are permitted to execute in an
38
- unordered fashion in < del > unspecified threads</ del > < ins > either the invoking thread or in a
39
- thread implicitly created by the library to support parallel algorithm execution.</ ins >
40
- < del > , and</ del > < ins > Any such invocations executing in the same thread are</ ins > indeterminately
41
- sequenced < del > within each thread</ del > < ins > with respect to each other</ ins > .
38
+ unordered fashion in either the invoking thread or in a thread implicitly created by the library
39
+ to support parallel algorithm execution. Any such invocations executing in the same thread are
40
+ indeterminately sequenced with respect to each other.
42
41
43
42
< cxx-note >
44
43
It is the caller's responsibility to ensure correctness, for example that the invocation does
@@ -296,9 +295,9 @@ <h1><code>ExecutionPolicy</code> algorithm overloads</h1>
296
295
< td > < code > transform</ code > </ td >
297
296
</ tr >
298
297
< tr >
299
- < td > < code > < ins > transform_exclusive_scan</ ins > </ code > </ td >
300
- < td > < code > < ins > transform_inclusive_scan</ ins > </ code > </ td >
301
- < td > < code > < ins > transform_reduce</ ins > </ code > </ td >
298
+ < td > < code > transform_exclusive_scan</ code > </ td >
299
+ < td > < code > transform_inclusive_scan</ code > </ td >
300
+ < td > < code > transform_reduce</ code > </ td >
302
301
< td > < code > uninitialized_copy</ code > </ td >
303
302
</ tr >
304
303
< tr >
@@ -374,6 +373,11 @@ <h1>Header <code><experimental/algorithm></code> synopsis</h1>
374
373
template<class InputIterator, class Size, class Function>
375
374
InputIterator for_each_n(InputIterator first, Size n,
376
375
Function f);
376
+ < ins > template<class ExecutionPolicy,
377
+ class InputIterator, class Size, class Function>
378
+ InputIterator for_each_n(ExecutionPolicy&& exec,
379
+ InputIterator first, Size n,
380
+ Function f);</ ins >
377
381
}
378
382
}
379
383
}
@@ -504,48 +508,105 @@ <h1>Header <code><experimental/numeric></code> synopsis</h1>
504
508
template<class InputIterator>
505
509
typename iterator_traits<InputIterator>::value_type
506
510
reduce(InputIterator first, InputIterator last);
511
+ < ins > template<class ExecutionPolicy,
512
+ InputIterator>
513
+ typename iterator_traits<InputIterator>::value_type
514
+ reduce(ExecutionPolicy&& exec,
515
+ InputIterator first, InputIterator last);</ ins >
507
516
template<class InputIterator, class T>
508
- T reduce(InputIterator first, InputIterator last< ins > ,</ ins > T init);
517
+ T reduce(InputIterator first, InputIterator last, T init);
518
+ < ins > template<class ExecutionPolicy,
519
+ class InputIterator, class T>
520
+ T reduce(ExecutionPolicy&& exec,
521
+ InputIterator first, InputIterator last, T init);</ ins >
509
522
template<class InputIterator, class T, class BinaryOperation>
510
523
T reduce(InputIterator first, InputIterator last, T init,
511
524
BinaryOperation binary_op);
525
+ < ins > template<class ExecutionPolicy, class InputIterator, class T, class BinaryOperation>
526
+ T reduce(ExecutionPolicy&& exec,
527
+ InputIterator first, InputIterator last, T init,
528
+ BinaryOperation binary_op);</ ins >
512
529
513
530
template<class InputIterator, class OutputIterator,
514
531
class T>
515
532
OutputIterator
516
533
exclusive_scan(InputIterator first, InputIterator last,
517
534
OutputIterator result,
518
535
T init);
536
+ < ins > template<class ExecutionPolicy,
537
+ class InputIterator, class OutputIterator,
538
+ class T>
539
+ OutputIterator
540
+ exclusive_scan(ExecutionPolicy&& exec,
541
+ InputIterator first, InputIterator last,
542
+ OutputIterator result,
543
+ T init);</ ins >
519
544
template<class InputIterator, class OutputIterator,
520
545
class T, class BinaryOperation>
521
546
OutputIterator
522
547
exclusive_scan(InputIterator first, InputIterator last,
523
548
OutputIterator result,
524
549
T init, BinaryOperation binary_op);
550
+ < ins > template<class ExecutionPolicy,
551
+ class InputIterator, class OutputIterator,
552
+ class T, class BinaryOperation>
553
+ OutputIterator
554
+ exclusive_scan(ExecutionPolicy&& exec,
555
+ InputIterator first, InputIterator last,
556
+ OutputIterator result,
557
+ T init, BinaryOperation binary_op);</ ins >
525
558
526
559
template<class InputIterator, class OutputIterator>
527
560
OutputIterator
528
561
inclusive_scan(InputIterator first, InputIterator last,
529
562
OutputIterator result);
563
+ < ins > template<class ExecutionPolicy,
564
+ class InputIterator, class OutputIterator>
565
+ OutputIterator
566
+ inclusive_scan(ExecutionPolicy&& exec,
567
+ InputIterator first, InputIterator last,
568
+ OutputIterator result);</ ins >
530
569
template<class InputIterator, class OutputIterator,
531
570
class BinaryOperation>
532
571
OutputIterator
533
572
inclusive_scan(InputIterator first, InputIterator last,
534
573
OutputIterator result,
535
574
BinaryOperation binary_op);
575
+ < ins > template<class ExecutionPolicy,
576
+ class InputIterator, class OutputIterator,
577
+ class BinaryOperation>
578
+ OutputIterator
579
+ inclusive_scan(ExecutionPolicy&& exec,
580
+ InputIterator first, InputIterator last,
581
+ OutputIterator result,
582
+ BinaryOperation binary_op);</ ins >
536
583
template<class InputIterator, class OutputIterator,
537
584
class BinaryOperation, class T>
538
585
OutputIterator
539
586
inclusive_scan(InputIterator first, InputIterator last,
540
587
OutputIterator result,
541
588
BinaryOperation binary_op, T init);
589
+ < ins > template<class ExecutionPolicy,
590
+ class InputIterator, class OutputIterator,
591
+ class BinaryOperation, class T>
592
+ OutputIterator
593
+ inclusive_scan(ExecutionPolicy&& exec,
594
+ InputIterator first, InputIterator last,
595
+ OutputIterator result,
596
+ BinaryOperation binary_op, T init);</ ins >
542
597
543
- < ins >
544
598
template<class InputIterator, class UnaryOperation,
545
599
class T, class BinaryOperation>
546
600
T transform_reduce(InputIterator first, InputIterator last,
547
601
UnaryOperation unary_op,
548
602
T init, BinaryOperation binary_op);
603
+ < ins > template<class ExecutionPolicy,
604
+ class InputIterator, class UnaryOperation,
605
+ class T, class BinaryOperation>
606
+ T transform_reduce(ExecutionPolicy&& exec,
607
+ InputIterator first, InputIterator last,
608
+ UnaryOperation unary_op,
609
+ T init, BinaryOperation binary_op);</ ins >
549
610
550
611
template<class InputIterator, class OutputIterator,
551
612
class UnaryOperation, class T, class BinaryOperation>
@@ -554,6 +615,15 @@ <h1>Header <code><experimental/numeric></code> synopsis</h1>
554
615
OutputIterator result,
555
616
UnaryOperation unary_op,
556
617
T init, BinaryOperation binary_op);
618
+ < ins > template<class ExecutionPolicy,
619
+ class InputIterator, class OutputIterator,
620
+ class UnaryOperation, class T, class BinaryOperation>
621
+ OutputIterator
622
+ transform_exclusive_scan(ExecutionPolicy&& exec,
623
+ InputIterator first, InputIterator last,
624
+ OutputIterator result,
625
+ UnaryOperation unary_op,
626
+ T init, BinaryOperation binary_op);</ ins >
557
627
558
628
template<class InputIterator, class OutputIterator,
559
629
class UnaryOperation, class BinaryOperation>
@@ -562,6 +632,15 @@ <h1>Header <code><experimental/numeric></code> synopsis</h1>
562
632
OutputIterator result,
563
633
UnaryOperation unary_op,
564
634
BinaryOperation binary_op);
635
+ < ins > template<class ExecutionPolicy,
636
+ class InputIterator, class OutputIterator,
637
+ class UnaryOperation, class BinaryOperation>
638
+ OutputIterator
639
+ transform_inclusive_scan(ExecutionPolicy&& exec,
640
+ InputIterator first, InputIterator last,
641
+ OutputIterator result,
642
+ UnaryOperation unary_op,
643
+ BinaryOperation binary_op);</ ins >
565
644
566
645
template<class InputIterator, class OutputIterator,
567
646
class UnaryOperation, class BinaryOperation, class T>
@@ -570,7 +649,15 @@ <h1>Header <code><experimental/numeric></code> synopsis</h1>
570
649
OutputIterator result,
571
650
UnaryOperation unary_op,
572
651
BinaryOperation binary_op, T init);
573
- </ ins >
652
+ < ins > template<class ExecutionPolicy,
653
+ class InputIterator, class OutputIterator,
654
+ class UnaryOperation, class BinaryOperation, class T>
655
+ OutputIterator
656
+ transform_inclusive_scan(ExecutionPolicy&& exec,
657
+ InputIterator first, InputIterator last,
658
+ OutputIterator result,
659
+ UnaryOperation unary_op,
660
+ BinaryOperation binary_op, T init);</ ins >
574
661
}
575
662
}
576
663
}
@@ -753,35 +840,25 @@ <h1>Transform reduce</h1>
753
840
754
841
< cxx-function >
755
842
< cxx-signature >
756
- < ins >
757
843
template<class InputIterator, class UnaryFunction, class T, class BinaryOperation>
758
844
T transform_reduce(InputIterator first, InputIterator last,
759
845
UnaryOperation unary_op, T init, BinaryOperation binary_op);
760
- </ ins >
761
846
</ cxx-signature >
762
847
763
848
< cxx-returns >
764
- < ins >
765
849
< code > < em > GENERALIZED_SUM</ em > (binary_op, init, unary_op(*first), ..., unary_op(*(first + (last - first) - 1)))</ code > .
766
- </ ins >
767
850
</ cxx-returns >
768
851
769
852
< cxx-requires >
770
- < ins >
771
853
Neither < code > unary_op</ code > nor < code > binary_op</ code > shall invalidate subranges, or modify elements in the range < code > [first,last)</ code >
772
- </ ins >
773
854
</ cxx-requires >
774
855
775
856
< cxx-complexity >
776
- < ins >
777
857
O(< code > last - first</ code > ) applications each of < code > unary_op</ code > and < code > binary_op</ code > .
778
- </ ins >
779
858
</ cxx-complexity >
780
859
781
860
< cxx-notes >
782
- < ins >
783
861
< code > transform_reduce</ code > does not apply < code > unary_op</ code > to < code > init</ code > .
784
- </ ins >
785
862
</ cxx-notes >
786
863
</ cxx-function >
787
864
</ cxx-section >
@@ -791,7 +868,6 @@ <h1>Transform exclusive scan</h1>
791
868
792
869
< cxx-function >
793
870
< cxx-signature >
794
- < ins >
795
871
template<class InputIterator, class OutputIterator,
796
872
class UnaryOperation,
797
873
class T, class BinaryOperation>
@@ -800,41 +876,30 @@ <h1>Transform exclusive scan</h1>
800
876
OutputIterator result,
801
877
UnaryOperation unary_op,
802
878
T init, BinaryOperation binary_op);
803
- </ ins >
804
879
</ cxx-signature >
805
880
806
881
< cxx-effects >
807
- < ins >
808
882
Assigns through each iterator < code > i</ code > in < code > [result,result + (last - first))</ code > the value of
809
883
< code > < em > GENERALIZED_NONCOMMUTATIVE_SUM</ em > (binary_op, init, unary_op(*first), ..., unary_op(*(first + (i - result) - 1)))</ code > .
810
- </ ins >
811
884
</ cxx-effects >
812
885
813
886
< cxx-returns >
814
- < ins >
815
887
The end of the resulting range beginning at < code > result</ code > .
816
- </ ins >
817
888
</ cxx-returns >
818
889
819
890
< cxx-requires >
820
- < ins >
821
891
Neither < code > unary_op</ code > nor < code > binary_op</ code > shall invalidate iterators or subranges, or modify elements in the
822
892
ranges < code > [first,last)</ code > or < code > [result,result + (last - first))</ code > .
823
- </ ins >
824
893
</ cxx-requires >
825
894
826
895
< cxx-complexity >
827
- < ins >
828
896
O(< code > last - first</ code > ) applications each of < code > unary_op</ code > and < code > binary_op</ code > .
829
- </ ins >
830
897
</ cxx-complexity >
831
898
832
899
< cxx-notes >
833
- < ins >
834
900
The difference between < code > transform_exclusive_scan</ code > and < code > transform_inclusive_scan</ code > is that < code > transform_exclusive_scan</ code >
835
901
excludes the ith input element from the ith sum. If < code > binary_op</ code > is not mathematically associative, the behavior of
836
902
< code > transform_exclusive_scan</ code > may be non-deterministic. < code > transform_exclusive_scan</ code > does not apply < code > unary_op</ code > to < code > init</ code > .
837
- </ ins >
838
903
</ cxx-notes >
839
904
</ cxx-function >
840
905
</ cxx-section >
@@ -844,7 +909,6 @@ <h1>Transform inclusive scan</h1>
844
909
845
910
< cxx-function >
846
911
< cxx-signature >
847
- < ins >
848
912
template<class InputIterator, class OutputIterator,
849
913
class UnaryOperation,
850
914
class BinaryOperation>
@@ -862,43 +926,32 @@ <h1>Transform inclusive scan</h1>
862
926
OutputIterator result,
863
927
UnaryOperation unary_op,
864
928
BinaryOperation binary_op, T init);
865
- </ ins >
866
929
</ cxx-signature >
867
930
868
931
< cxx-effects >
869
- < ins >
870
932
Assigns through each iterator < code > i</ code > in < code > [result,result + (last - first))</ code > the value of
871
933
< code > < em > GENERALIZED_NONCOMMUTATIVE_SUM</ em > (binary_op, unary_op(*first), ..., unary_op(*(first + (i - result))))</ code > or
872
934
< code > < em > GENERALIZED_NONCOMMUTATIVE_SUM</ em > (binary_op, init, unary_op(*first), ..., unary_op(*(first + (i - result))))</ code >
873
935
if < code > init</ code > is provided.
874
- </ ins >
875
936
</ cxx-effects >
876
937
877
938
< cxx-returns >
878
- < ins >
879
939
The end of the resulting range beginning at < code > result</ code > .
880
- </ ins >
881
940
</ cxx-returns >
882
941
883
942
< cxx-requires >
884
- < ins >
885
943
Neither < code > unary_op</ code > nor < code > binary_op</ code > shall invalidate iterators or subranges, or modify elements in the ranges < code > [first,last)</ code >
886
944
or < code > [result,result + (last - first))</ code > .
887
- </ ins >
888
945
</ cxx-requires >
889
946
890
947
< cxx-complexity >
891
- < ins >
892
948
O(< code > last - first</ code > ) applications each of < code > unary_op</ code > and < code > binary_op</ code > .
893
- </ ins >
894
949
</ cxx-complexity >
895
950
896
951
< cxx-notes >
897
- < ins >
898
- The difference between < code > transform_exclusive_scan</ code > and < code > transform_inclusive_scan</ code > is that < code > transform_inclusive_scan</ code >
899
- includes the ith input element from the ith sum. If < code > binary_op</ code > is not mathematically associative, the behavior of
900
- < code > transform_inclusive_scan</ code > may be non-deterministic. < code > transform_inclusive_scan</ code > does not apply < code > unary_op</ code > to < code > init</ code > .
901
- </ ins >
952
+ The difference between < code > transform_exclusive_scan</ code > and < code > transform_inclusive_scan</ code > is that < code > transform_inclusive_scan</ code >
953
+ includes the ith input element from the ith sum. If < code > binary_op</ code > is not mathematically associative, the behavior of
954
+ < code > transform_inclusive_scan</ code > may be non-deterministic. < code > transform_inclusive_scan</ code > does not apply < code > unary_op</ code > to < code > init</ code > .
902
955
</ cxx-notes >
903
956
</ cxx-function >
904
957
</ cxx-section >
0 commit comments