diff options
Diffstat (limited to 'system/include/libcxx/array')
-rw-r--r-- | system/include/libcxx/array | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/system/include/libcxx/array b/system/include/libcxx/array index 3ac4c55b..f4a3020a 100644 --- a/system/include/libcxx/array +++ b/system/include/libcxx/array @@ -55,7 +55,7 @@ struct array // capacity: constexpr size_type size() const noexcept; constexpr size_type max_size() const noexcept; - bool empty() const noexcept; + constexpr bool empty() const noexcept; // element access: reference operator[](size_type n); @@ -111,7 +111,9 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; #include <cassert> #endif +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -171,11 +173,11 @@ struct _LIBCPP_VISIBLE array // capacity: _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ size_type size() const _NOEXCEPT {return _Size;} + _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;} _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;} + _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;} _LIBCPP_INLINE_VISIBILITY - bool empty() const _NOEXCEPT {return _Size == 0;} + _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;} // element access: _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];} @@ -308,6 +310,7 @@ _LIBCPP_INLINE_VISIBILITY inline _Tp& get(array<_Tp, _Size>& __a) _NOEXCEPT { + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)"); return __a[_Ip]; } @@ -316,6 +319,7 @@ _LIBCPP_INLINE_VISIBILITY inline const _Tp& get(const array<_Tp, _Size>& __a) _NOEXCEPT { + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)"); return __a[_Ip]; } @@ -326,6 +330,7 @@ _LIBCPP_INLINE_VISIBILITY inline _Tp&& get(array<_Tp, _Size>&& __a) _NOEXCEPT { + static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)"); return _VSTD::move(__a[_Ip]); } |