This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3 PATCH] Implement P0040R3, Extending memory management tools.
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 13 Sep 2016 09:16:17 +0100
- Subject: Re: [v3 PATCH] Implement P0040R3, Extending memory management tools.
- Authentication-results: sourceware.org; auth=none
- References: <CAFk2RUag51kZFhDK8n6wvOH3YCpGW4P7WqP=cNGyELYJ8MxNqw@mail.gmail.com>
On 13/09/16 00:59 +0300, Ville Voutilainen wrote:
@@ -682,6 +686,98 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::__iterator_category(__first)); }
#endif
+#if __cplusplus > 201402L
+ template <typename _ForwardIterator>
+ inline void
+ uninitialized_default_construct(_ForwardIterator __first,
+ _ForwardIterator __last)
+ {
+ for (; __first != __last; ++__first)
+ ::new (static_cast<void*>(std::__addressof(*__first)))
+ typename iterator_traits<_ForwardIterator>::value_type;
+ }
The bodies of all these function templates should be indented another
two spaces, to line up with the function name.
+ template <typename _Tp>
+ inline void
+ destroy_at(_Tp* __location)
+ {
+ __location->~_Tp();
+ }
This is now the third function template we've added recently doing
this :-) (although the ones in <variant> and <bits/exception_ptr.h>
have void* parameters).
+ template <typename _ForwardIterator>
+ inline void
+ destroy(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ for (; __first != __last; ++__first)
+ destroy_at(std::__addressof(*__first));
This needs to be std::destroy_at
+ }
+
+ template <typename _ForwardIterator, typename _Size>
+ inline _ForwardIterator
+ destroy_n(_ForwardIterator __first, _Size __count)
+ {
+ for (; __count > 0; (void)++__first, --__count)
+ destroy_at(std::__addressof(*__first));
Ditto.
OK with those changes, thanks.