[libcxx-commits] [libcxx] 66a14d1 - [libc++] NFC: Minor refactoring in std::array
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 1 13:31:22 PDT 2020
Author: Louis Dionne
Date: 2020-06-01T16:28:44-04:00
New Revision: 66a14d151efb8d142e23f88166e76bfe3730adda
URL: https://github.com/llvm/llvm-project/commit/66a14d151efb8d142e23f88166e76bfe3730adda
DIFF: https://github.com/llvm/llvm-project/commit/66a14d151efb8d142e23f88166e76bfe3730adda.diff
LOG: [libc++] NFC: Minor refactoring in std::array
Added:
Modified:
libcxx/include/array
Removed:
################################################################################
diff --git a/libcxx/include/array b/libcxx/include/array
index 68743773f1a3..6cd4d199372a 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -150,12 +150,12 @@ struct _LIBCPP_TEMPLATE_VIS array
// No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void fill(const value_type& __u) {
- _VSTD::fill_n(__elems_, _Size, __u);
+ _VSTD::fill_n(data(), _Size, __u);
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
- std::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);
+ std::swap_ranges(data(), data() + _Size, __a.data());
}
// iterators:
@@ -192,7 +192,7 @@ struct _LIBCPP_TEMPLATE_VIS array
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return false; }
+ _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
// element access:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
More information about the libcxx-commits
mailing list