aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-10-01 22:02:27 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-10-01 22:02:27 +0100
commita16bc2f317ddfeb45a6b293aec4d89afe0e79a72 (patch)
tree8dca7bf0ebe5df3f47f333d32a4ecc64536fb1dc
parente12097eda087e492ec22adaaf368cc63c3284c4e (diff)
downloadgcc-a16bc2f317ddfeb45a6b293aec4d89afe0e79a72.zip
gcc-a16bc2f317ddfeb45a6b293aec4d89afe0e79a72.tar.gz
gcc-a16bc2f317ddfeb45a6b293aec4d89afe0e79a72.tar.bz2
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. From-SVN: r276432
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/experimental/algorithm6
-rw-r--r--libstdc++-v3/include/parallel/algo.h5
3 files changed, 13 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 45ad851..9cf1c9a 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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.
diff --git a/libstdc++-v3/include/experimental/algorithm b/libstdc++-v3/include/experimental/algorithm
index 8ba212c..f036a71 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 afa325b..ab0540c 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