Author: Vitaly Buka Date: 2024-05-22T04:28:03-07:00 New Revision: e8e53a594603300ba9faf03ce3e4e157ee036feb
URL: https://github.com/llvm/llvm-project/commit/e8e53a594603300ba9faf03ce3e4e157ee036feb DIFF: https://github.com/llvm/llvm-project/commit/e8e53a594603300ba9faf03ce3e4e157ee036feb.diff LOG: Revert "[libc++][vector] Inline remaining constructors filling vector with th…" This reverts commit c7e9b4918e5bd4936dbc036ba65eae178f5cc994. Added: Modified: libcxx/include/vector Removed: ################################################################################ diff --git a/libcxx/include/vector b/libcxx/include/vector index b190557fb7b7e..976bde9b9048c 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -424,36 +424,11 @@ public: #endif : __end_cap_(nullptr, __a) { } - - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n) { - auto __guard = std::__make_exception_guard(__destroy_vector(*this)); - if (__n > 0) { - __vallocate(__n); - __construct_at_end(__n); - } - __guard.__complete(); - } - + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n); #if _LIBCPP_STD_VER >= 14 - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a) - : __end_cap_(nullptr, __a) { - auto __guard = std::__make_exception_guard(__destroy_vector(*this)); - if (__n > 0) { - __vallocate(__n); - __construct_at_end(__n); - } - __guard.__complete(); - } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a); #endif - - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x) { - auto __guard = std::__make_exception_guard(__destroy_vector(*this)); - if (__n > 0) { - __vallocate(__n); - __construct_at_end(__n, __x); - } - __guard.__complete(); - } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x); template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI @@ -1150,6 +1125,39 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::__append(size_type _ } } +template <class _Tp, class _Allocator> +_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n) { + auto __guard = std::__make_exception_guard(__destroy_vector(*this)); + if (__n > 0) { + __vallocate(__n); + __construct_at_end(__n); + } + __guard.__complete(); +} + +#if _LIBCPP_STD_VER >= 14 +template <class _Tp, class _Allocator> +_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) + : __end_cap_(nullptr, __a) { + auto __guard = std::__make_exception_guard(__destroy_vector(*this)); + if (__n > 0) { + __vallocate(__n); + __construct_at_end(__n); + } + __guard.__complete(); +} +#endif + +template <class _Tp, class _Allocator> +_LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x) { + auto __guard = std::__make_exception_guard(__destroy_vector(*this)); + if (__n > 0) { + __vallocate(__n); + __construct_at_end(__n, __x); + } + __guard.__complete(); +} + template <class _Tp, class _Allocator> template <class _InputIterator, __enable_if_t<__has_exactly_input_iterator_category<_InputIterator>::value && _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits