[gcc(refs/users/ppalka/heads/libstdcxx-ranges-algos-nieblification)] forward declare ranges::destroy
Patrick Palka
ppalka@gcc.gnu.org
Thu Feb 13 20:56:00 GMT 2020
https://gcc.gnu.org/g:bc234336496de15491215ec6accedd066ad8a288
commit bc234336496de15491215ec6accedd066ad8a288
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Feb 13 12:31:10 2020 -0500
forward declare ranges::destroy
Diff:
---
libstdc++-v3/include/bits/ranges_uninitialized.h | 61 ++++++++++++++----------
1 file changed, 36 insertions(+), 25 deletions(-)
diff --git a/libstdc++-v3/include/bits/ranges_uninitialized.h b/libstdc++-v3/include/bits/ranges_uninitialized.h
index a5b0c08..fa4238b 100644
--- a/libstdc++-v3/include/bits/ranges_uninitialized.h
+++ b/libstdc++-v3/include/bits/ranges_uninitialized.h
@@ -78,6 +78,22 @@ namespace ranges
&& __nothrow_forward_iterator<iterator_t<_Range>>);
} // namespace __detail
+ struct __destroy_fn
+ {
+ template<__detail::__nothrow_input_iterator _Iter,
+ __detail::__nothrow_sentinel<_Iter> _Sent>
+ requires destructible<iter_value_t<_Iter>>
+ constexpr _Iter
+ operator()(_Iter __first, _Sent __last) const noexcept;
+
+ template<__detail::__nothrow_input_range _Range>
+ requires destructible<range_value_t<_Range>>
+ constexpr safe_iterator_t<_Range>
+ operator()(_Range&& __r) const noexcept;
+ };
+
+ inline constexpr __destroy_fn destroy{};
+
namespace __detail
{
template<typename _Iter>
@@ -505,32 +521,27 @@ namespace ranges
inline constexpr __destroy_at_fn destroy_at{};
- struct __destroy_fn
- {
- template<__detail::__nothrow_input_iterator _Iter,
- __detail::__nothrow_sentinel<_Iter> _Sent>
- requires destructible<iter_value_t<_Iter>>
- constexpr _Iter
- operator()(_Iter __first, _Sent __last) const noexcept
- {
- if constexpr (is_trivially_destructible_v<iter_value_t<_Iter>>)
- return ranges::next(__first, __last);
- else
- {
- for (; __first != __last; ++__first)
- ranges::destroy_at(std::__addressof(*__first));
- return __first;
- }
- }
-
- template<__detail::__nothrow_input_range _Range>
- requires destructible<range_value_t<_Range>>
- constexpr safe_iterator_t<_Range>
- operator()(_Range&& __r) const noexcept
- { return (*this)(ranges::begin(__r), ranges::end(__r)); }
- };
+ template<__detail::__nothrow_input_iterator _Iter,
+ __detail::__nothrow_sentinel<_Iter> _Sent>
+ requires destructible<iter_value_t<_Iter>>
+ constexpr _Iter
+ __destroy_fn::operator()(_Iter __first, _Sent __last) const noexcept
+ {
+ if constexpr (is_trivially_destructible_v<iter_value_t<_Iter>>)
+ return ranges::next(__first, __last);
+ else
+ {
+ for (; __first != __last; ++__first)
+ ranges::destroy_at(std::__addressof(*__first));
+ return __first;
+ }
+ }
- inline constexpr __destroy_fn destroy{};
+ template<__detail::__nothrow_input_range _Range>
+ requires destructible<range_value_t<_Range>>
+ constexpr safe_iterator_t<_Range>
+ __destroy_fn::operator()(_Range&& __r) const noexcept
+ { return (*this)(ranges::begin(__r), ranges::end(__r)); }
struct __destroy_n_fn
{
More information about the Libstdc++-cvs
mailing list