[libcxx-commits] [libcxx] [libc++] Optimize vector growing of trivially relocatable types (PR #76657)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 1 04:04:24 PST 2024


================
@@ -45,6 +47,10 @@ class _LIBCPP_TEMPLATE_VIS allocator;
 template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
 class _LIBCPP_TEMPLATE_VIS basic_string;
 
+// TODO: This could be extended to also allow custom allocators and possibly custom chars and char traits
+template <class _CharT>
+struct __libcpp_is_trivially_relocatable<basic_string<_CharT>> : is_fundamental<_CharT> {};
----------------
philnik777 wrote:

That's a property of `basic_string` and not of the trivially relocatable trait though. There is no need to constrain the trait - only `basic_string` itself.

https://github.com/llvm/llvm-project/pull/76657


More information about the libcxx-commits mailing list