[PATCH] D48342: [libcxx] Optimize vectors construction of trivial types from an iterator range with const-ness mismatch.

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 26 07:11:09 PDT 2018


erik.pilkington added a comment.

Hi Volodymyr, thanks for working on this!



================
Comment at: libcxx/include/memory:1479
+struct __has_construct_missing
+    : false_type
+{
----------------
Shouldn't this be true_type?


================
Comment at: libcxx/include/memory:1673-1677
+            (is_same
+             <
+                typename _VSTD::remove_const<typename allocator_type::value_type>::type,
+                typename _VSTD::remove_const<_SourceTp>::type
+             >::value
----------------
I'm not sure if this is correct. Previously, we only selected this overload if the allocator didn't have a construct() member, or if it was a std::allocator, in which case we know construct() just called in-place new. With this patch, we would select this overload for a custom allocator that overrode construct() so long as the value_types matched. I think the right behaviour for the custom allocator case would be to use the construct() member instead of memcpying.


https://reviews.llvm.org/D48342





More information about the cfe-commits mailing list