[libcxx-commits] [PATCH] D147741: [libc++, std::vector] call the optimized version of __uninitialized_allocator_copy for trivial types
Aditya Kumar via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 27 17:06:58 PDT 2023
hiraditya added inline comments.
================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:553-558
+ /* Adding this calls the other overload for vector<int>
+ class _RawType = __remove_const_t<_Iter2>,
+ __enable_if_t<
+ // using _RawType because of the allocator<T const> extension
+ !is_trivially_copy_constructible<_RawType>::value || !is_trivially_copy_assignable<_RawType>::value ||
+ !__allocator_has_trivial_copy_construct<_Alloc, _RawType>::value>* */ >
----------------
philnik wrote:
> hiraditya wrote:
> > philnik wrote:
> > > I think this can be fixed by using different types for the `__first1` and `__first2` pointers and adding the condition `is_same<__remove_cv_t<_Type1>, __remove_cv_t<_Type2>>::value` to the `enable_if` in the raw pointer overload. Then that overload will always have priority over the more generic one. Then this overload (the generic one) doesn't need any `enable_if`s.
> > The Iter version is still selected with this change.
> Works for me: https://godbolt.org/z/4hh75oY9f
Ah i see, removing the `const` from args made it work i think. I'll re-use your version then. Thanks so much!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147741/new/
https://reviews.llvm.org/D147741
More information about the libcxx-commits
mailing list