diff mbox series

Make some new algorithms work in parallel mode

Message ID 20191001210155.GQ9487@redhat.com
State New
Headers show
Series Make some new algorithms work in parallel mode | expand

Commit Message

Jonathan Wakely Oct. 1, 2019, 9:01 p.m. UTC
Tested x86_64-linux (normal and parallel modes), committed to trunk.
diff mbox series

Patch

commit 92d5df45f3e62d31bebcdea9c1568b0877d0fe0e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Oct 1 20:34:22 2019 +0100

    Make some new algorithms work in parallel mode
    
            * 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.

diff --git a/libstdc++-v3/include/experimental/algorithm b/libstdc++-v3/include/experimental/algorithm
index 8ba212c5132..f036a713ef3 100644
--- a/libstdc++-v3/include/experimental/algorithm
+++ b/libstdc++-v3/include/experimental/algorithm
@@ -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,
diff --git a/libstdc++-v3/include/parallel/algo.h b/libstdc++-v3/include/parallel/algo.h
index afa325bb4af..ab0540c1129 100644
--- a/libstdc++-v3/include/parallel/algo.h
+++ b/libstdc++-v3/include/parallel/algo.h
@@ -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