aboutsummaryrefslogtreecommitdiff
path: root/include/array
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2014-01-29 19:30:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2014-01-29 19:30:27 +0000
commita5b2dbc259e289ea23fe9aebb34eba2c1dc7fefb (patch)
tree5812a629bd48b0968dee7411809c6a6a19680390 /include/array
parent1c9014238e909c768bf84564733b5441d5c9ea2b (diff)
downloadsrc-a5b2dbc259e289ea23fe9aebb34eba2c1dc7fefb.tar.gz
src-a5b2dbc259e289ea23fe9aebb34eba2c1dc7fefb.zip
Vendor import of libc++ tags/RELEASE_34/final r197960:vendor/libc++/r197960
Notes
Notes: svn path=/vendor/libc++/dist/; revision=261272 svn path=/vendor/libc++/r197960/; revision=261273; tag=vendor/libc++/r197960
Diffstat (limited to 'include/array')
-rw-r--r--include/array59
1 files changed, 30 insertions, 29 deletions
diff --git a/include/array b/include/array
index bcf53478677e..d37075da1a2a 100644
--- a/include/array
+++ b/include/array
@@ -59,14 +59,14 @@ struct array
// element access:
reference operator[](size_type n);
- const_reference operator[](size_type n) const;
- const_reference at(size_type n) const;
+ const_reference operator[](size_type n) const; // constexpr in C++14
+ const_reference at(size_type n) const; // constexpr in C++14
reference at(size_type n);
reference front();
- const_reference front() const;
+ const_reference front() const; // constexpr in C++14
reference back();
- const_reference back() const;
+ const_reference back() const; // constexpr in C++14
T* data() noexcept;
const T* data() const noexcept;
@@ -92,9 +92,9 @@ template <class T> class tuple_size;
template <int I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
-template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
-template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
-template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
+template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
+template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
+template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
} // std
@@ -118,7 +118,7 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
-struct _LIBCPP_TYPE_VIS array
+struct _LIBCPP_TYPE_VIS_ONLY array
{
// types:
typedef array __self;
@@ -181,14 +181,14 @@ struct _LIBCPP_TYPE_VIS array
// element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
- _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
reference at(size_type __n);
- const_reference at(size_type __n) const;
+ _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
- _LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[0];}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
- _LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY
value_type* data() _NOEXCEPT {return __elems_;}
@@ -210,6 +210,7 @@ array<_Tp, _Size>::at(size_type __n)
}
template <class _Tp, size_t _Size>
+_LIBCPP_CONSTEXPR_AFTER_CXX11
typename array<_Tp, _Size>::const_reference
array<_Tp, _Size>::at(size_type __n) const
{
@@ -223,7 +224,7 @@ array<_Tp, _Size>::at(size_type __n) const
}
template <class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -231,7 +232,7 @@ operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -239,7 +240,7 @@ operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -247,7 +248,7 @@ operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -255,7 +256,7 @@ operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -263,7 +264,7 @@ operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -271,7 +272,7 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
__is_swappable<_Tp>::value,
@@ -284,54 +285,54 @@ swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
-class _LIBCPP_TYPE_VIS tuple_size<array<_Tp, _Size> >
+class _LIBCPP_TYPE_VIS_ONLY tuple_size<array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <class _Tp, size_t _Size>
-class _LIBCPP_TYPE_VIS tuple_size<const array<_Tp, _Size> >
+class _LIBCPP_TYPE_VIS_ONLY tuple_size<const array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size>
-class _LIBCPP_TYPE_VIS tuple_element<_Ip, array<_Tp, _Size> >
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> >
{
public:
typedef _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
-class _LIBCPP_TYPE_VIS tuple_element<_Ip, const array<_Tp, _Size> >
+class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const array<_Tp, _Size> >
{
public:
typedef const _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp&
get(array<_Tp, _Size>& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
- return __a[_Ip];
+ return __a.__elems_[_Ip];
}
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
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];
+ return __a.__elems_[_Ip];
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <size_t _Ip, class _Tp, size_t _Size>
-_LIBCPP_INLINE_VISIBILITY inline
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_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]);
+ return _VSTD::move(__a.__elems_[_Ip]);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES