[libcxx-commits] [PATCH] D128146: [libc++] Use uninitialized algorithms for vector

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 14 08:21:58 PDT 2022


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

LGTM with comments applied.



================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:33-34
 
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
----------------
I don't think we need to add this. We don't use `min()` or `max()` in this file.


================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:504
 
+// Destroy all elements in [__first, __last) from left to right.
+template <class _Alloc, class _Iter, class _Sent>
----------------
Nitpick.


================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:528-530
+// Copy-construct [__first1, __last1) in [__first2, __first2 + distance(__first1, __last1)). The caller has to ensure
+// that __first2 can hold at least distance(__first1, __last1) uninitialized elements. If an exception is thrown the
+// already copied elements are destroyed in reverse order of their construction.
----------------



================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:574-576
+// Move-construct the elements [__first1, __last1) into [__first2, __first2 + distance(__first1, __last1)) if the
+// move constructor is noexcept. Otherwise try to copy all elements. If an exception is thrown the already copied
+// elements are destroyed in reverse order of their construction.
----------------



================
Comment at: libcxx/include/__memory/uninitialized_algorithms.h:622
 
+_LIBCPP_POP_MACROS
+
----------------
Same, can be removed.


================
Comment at: libcxx/include/__utility/transaction.h:89-90
 
+template <class _Rollback>
+__transaction<_Rollback> __make_transaction(_Rollback __rollback) {
+    return __transaction<_Rollback>(__rollback);
----------------
`_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR` ?


================
Comment at: libcxx/include/__utility/transaction.h:91
+__transaction<_Rollback> __make_transaction(_Rollback __rollback) {
+    return __transaction<_Rollback>(__rollback);
+}
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128146/new/

https://reviews.llvm.org/D128146



More information about the libcxx-commits mailing list