[libcxx-commits] [PATCH] D115626: [libc++][ranges] Implement `uninitialized_value_construct{, _n}` and `uninitialized_fill{, _n}`.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 13 13:19:49 PST 2021
ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.
================
Comment at: libcxx/include/__memory/ranges_uninitialized_algorithms.h:46-47
using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>;
- return _VSTD::__uninitialized_default_construct<_ValueType>(__first, __last);
+ return _VSTD::__uninitialized_default_construct<_ValueType>(
+ _VSTD::move(__first), _VSTD::move(__last));
}
----------------
How many columns do you have your Clang format configured to?
================
Comment at: libcxx/include/__memory/ranges_uninitialized_algorithms.h:87
+
+struct __uninitialized_value_construct_fn final : private __function_like {
+
----------------
Please use `namespace uninitialized_value_construct_ns` and `__fn` until we've settled on whether we want to move everything to a different convention, to avoid inconsistencies.
================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:100
+template <class _ForwardIterator, class _Tp>
+void uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x)
+{
----------------
Let's make those `_LIBCPP_HIDE_FROM_ABI`.
================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:150
for (; __idx != __last; ++__idx)
- ::new ((void*)_VSTD::addressof(*__idx)) _ValueType;
+ ::new (__voidify(*__idx)) _ValueType;
#ifndef _LIBCPP_NO_EXCEPTIONS
----------------
Here and elsewhere.
================
Comment at: libcxx/include/__memory/voidify.h:25-29
+{
+ // Note: a C-style cast can cast away cv-qualifiers (it can be equivalent to
+ // doing a `static_cast` followed by a `const_cast`), thus achieving the
+ // same effect as the Standard mandates.
+ return (void*)_VSTD::addressof(__from);
----------------
Any reason why we don't literally copy-paste the definition from the Standard?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115626/new/
https://reviews.llvm.org/D115626
More information about the libcxx-commits
mailing list