[libcxx-commits] [PATCH] D67524: P1144 "Trivially relocatable" (3/3): optimize std::vector for trivially relocatable types
Zoe Carver via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Sep 12 17:05:00 PDT 2019
zoecarver added a comment.
Note: `std::is_constant_evaluated()` is implemented and you can use `__libcpp_is_constant_evaluated` before C++2a.
I'm going to play around with this patch (and the others) a bit. Then, I can give a more full review.
================
Comment at: include/memory:1614
void
- __construct_forward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2)
+ __construct_forward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2, false_type)
{
----------------
Maybe leave a comment about what the various overloads mean.
Also, maybe add a default value (in case we want to use this outside of `std::vector` in the future).
================
Comment at: include/memory:5760
+template <class _Alloc>
+struct __has_customized_allocator_traits<_Alloc, typename allocator_traits<_Alloc>::__is_uncustomized> : false_type {};
+
----------------
Nit: it might be less confusing to just use `::allocator_type`.
================
Comment at: include/memory:5770
+struct __has_trivial_construct : integral_constant<bool,
+ (__is_exactly_std_allocator<_Alloc>::value || !__has_construct<_Alloc, _Tp*, _Args...>::value) &&
+ !__has_customized_allocator_traits<_Alloc>::value
----------------
The more we can use `_And` the better. That way, at some point in the future, we can create an `__and` builtin type trait and improve build performance a bit.
================
Comment at: include/vector:479
+ __has_trivial_construct<_Allocator, _Tp,
+#ifndef _LIBCPP_CXX03_LANG
+ _Tp&&
----------------
We don't need to do this anymore! Every compiler that we support supports rvalues (I think).
Repository:
rCXX libc++
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67524/new/
https://reviews.llvm.org/D67524
More information about the libcxx-commits
mailing list