Forgot gcc-patches@ ---------- Forwarded message ---------- From: Marc Glisse <marc.gli...@inria.fr> Reply-To: libstd...@gcc.gnu.org To: Jonathan Wakely <jwak...@redhat.com> Cc: Ville Voutilainen <ville.voutilai...@gmail.com>, libstdc++ <libstd...@gcc.gnu.org> Date: Mon, 4 Feb 2019 19:26:35 +0100 (CET) Subject: Re: Reserve __is_trivially_relocatable for a builtin?
2019-02-04 Marc Glisse <marc.gli...@inria.fr> PR libstdc++/87106 * include/bits/stl_uninitialized.h (__is_trivially_relocatable): Rename... (__is_bitwise_relocatable): ... to this. (__relocate_a_1): Adapt. * include/bits/stl_deque.h (__is_trivially_relocatable): Rename... (__is_bitwise_relocatable): ... to this.I think it is trivial (pun!) and essentially pre-approved, but it doesn't hurt to ask.
-- Marc Glisse
Index: include/bits/stl_deque.h =================================================================== --- include/bits/stl_deque.h (revision 268524) +++ include/bits/stl_deque.h (working copy) @@ -54,21 +54,21 @@ */ #ifndef _STL_DEQUE_H #define _STL_DEQUE_H 1 #include <bits/concept_check.h> #include <bits/stl_iterator_base_types.h> #include <bits/stl_iterator_base_funcs.h> #if __cplusplus >= 201103L #include <initializer_list> -#include <bits/stl_uninitialized.h> // for __is_trivially_relocatable +#include <bits/stl_uninitialized.h> // for __is_bitwise_relocatable #endif #include <debug/assertions.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** @@ -2365,18 +2365,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { __x.swap(__y); } #undef _GLIBCXX_DEQUE_BUF_SIZE _GLIBCXX_END_NAMESPACE_CONTAINER #if __cplusplus >= 201103L // std::allocator is safe, but it is not the only allocator // for which this is valid. template<class _Tp> - struct __is_trivially_relocatable<_GLIBCXX_STD_C::deque<_Tp>> + struct __is_bitwise_relocatable<_GLIBCXX_STD_C::deque<_Tp>> : true_type { }; #endif _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif /* _STL_DEQUE_H */ Index: include/bits/stl_uninitialized.h =================================================================== --- include/bits/stl_uninitialized.h (revision 268524) +++ include/bits/stl_uninitialized.h (working copy) @@ -889,26 +889,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __dest, std::move(*__orig))) && noexcept(std::allocator_traits<_Allocator>::destroy( __alloc, std::__addressof(*__orig)))) { typedef std::allocator_traits<_Allocator> __traits; __traits::construct(__alloc, __dest, std::move(*__orig)); __traits::destroy(__alloc, std::__addressof(*__orig)); } // This class may be specialized for specific types. + // Also known as is_trivially_relocatable. template<typename _Tp, typename = void> - struct __is_trivially_relocatable + struct __is_bitwise_relocatable : is_trivial<_Tp> { }; template <typename _Tp, typename _Up> - inline __enable_if_t<std::__is_trivially_relocatable<_Tp>::value, _Tp*> + inline __enable_if_t<std::__is_bitwise_relocatable<_Tp>::value, _Tp*> __relocate_a_1(_Tp* __first, _Tp* __last, _Tp* __result, allocator<_Up>& __alloc) noexcept { ptrdiff_t __count = __last - __first; if (__count > 0) __builtin_memmove(__result, __first, __count * sizeof(_Tp)); return __result + __count; } template <typename _InputIterator, typename _ForwardIterator,