aboutsummaryrefslogtreecommitdiff
path: root/system/include/libcxx/array
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-01 12:55:33 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-01 12:55:33 -0700
commit8408257cd66435af849f493c10c7f0e8d1d5fa3b (patch)
tree8b05963e8608b22f71620f512679d7cd5b1de548 /system/include/libcxx/array
parenta8e4801c7d38033fff760ea26a4579aa324e303e (diff)
parent36600f34ef0ec2cf75165be3753567e256f514db (diff)
Merge branch 'incoming'
Diffstat (limited to 'system/include/libcxx/array')
-rw-r--r--system/include/libcxx/array13
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]);
}