Make some new algorithms work in parallel mode
authorJonathan Wakely <jwakely@redhat.com>
Tue, 1 Oct 2019 21:02:27 +0000 (22:02 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 1 Oct 2019 21:02:27 +0000 (22:02 +0100)
* include/experimental/algorithm (experimental::sample): Qualify call
to __sample correctly.
* include/parallel/algo.h (sample, for_each_n): Add using-declarations
for algorithms that don't have parallel implementations.

From-SVN: r276432

libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/algorithm
libstdc++-v3/include/parallel/algo.h

index 45ad851..9cf1c9a 100644 (file)
@@ -1,5 +1,10 @@
 2019-10-01  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/experimental/algorithm (experimental::sample): Qualify call
+       to __sample correctly.
+       * include/parallel/algo.h (sample, for_each_n): Add using-declarations
+       for algorithms that don't have parallel implementations.
+
        * include/parallel/algobase.h (equal, lexicographical_compare): Add
        _GLIBCXX20_CONSTEXPR and dispatch to sequential algorithm when being
        constant evaluated.
index 8ba212c..f036a71 100644 (file)
@@ -77,9 +77,9 @@ inline namespace fundamentals_v2
                    "sample size must be an integer type");
 
       typename iterator_traits<_PopulationIterator>::difference_type __d = __n;
-      return std::__sample(__first, __last, __pop_cat{}, __out, __samp_cat{},
-                          __d,
-                          std::forward<_UniformRandomNumberGenerator>(__g));
+      return _GLIBCXX_STD_A::
+       __sample(__first, __last, __pop_cat{}, __out, __samp_cat{}, __d,
+                std::forward<_UniformRandomNumberGenerator>(__g));
     }
 
   template<typename _PopulationIterator, typename _SampleIterator,
index afa325b..ab0540c 100644 (file)
@@ -2189,6 +2189,11 @@ namespace __parallel
       return __min_element_switch(__begin, __end, __comp,
                                  std::__iterator_category(__begin));
     }
+
+#if __cplusplus >= 201703L
+  using _GLIBCXX_STD_A::for_each_n;
+  using _GLIBCXX_STD_A::sample;
+#endif
 } // end namespace
 } // end namespace