aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2020-06-01 16:28:44 -0400
committerLouis Dionne <ldionne@apple.com>2020-06-01 16:28:44 -0400
commit66a14d151efb8d142e23f88166e76bfe3730adda (patch)
treeac3a566fe35f33d05e425659b73f3e72cec67660
parent1a4fb2edcb908d6c9141036d29b46a347b1b6f18 (diff)
downloadllvm-66a14d151efb8d142e23f88166e76bfe3730adda.zip
llvm-66a14d151efb8d142e23f88166e76bfe3730adda.tar.gz
llvm-66a14d151efb8d142e23f88166e76bfe3730adda.tar.bz2
[libc++] NFC: Minor refactoring in std::array
-rw-r--r--libcxx/include/array6
1 files changed, 3 insertions, 3 deletions
diff --git a/libcxx/include/array b/libcxx/include/array
index 6874377..6cd4d19 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