[cfe-commits] [libcxx] r132359 - in /libcxx/trunk/include: __tuple array
Howard Hinnant
hhinnant at apple.com
Tue May 31 14:06:33 PDT 2011
Author: hhinnant
Date: Tue May 31 16:06:33 2011
New Revision: 132359
URL: http://llvm.org/viewvc/llvm-project?rev=132359&view=rev
Log:
noexcept for <array>.
Modified:
libcxx/trunk/include/__tuple
libcxx/trunk/include/array
Modified: libcxx/trunk/include/__tuple
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tuple?rev=132359&r1=132358&r2=132359&view=diff
==============================================================================
--- libcxx/trunk/include/__tuple (original)
+++ libcxx/trunk/include/__tuple Tue May 31 16:06:33 2011
@@ -102,15 +102,15 @@
template <size_t _Ip, class _Tp, size_t _Size>
_Tp&
-get(array<_Tp, _Size>&);
+get(array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
const _Tp&
-get(const array<_Tp, _Size>&);
+get(const array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_Tp&&
-get(array<_Tp, _Size>&&);
+get(array<_Tp, _Size>&&) _NOEXCEPT;
// __make_tuple_indices
Modified: libcxx/trunk/include/array
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=132359&r1=132358&r2=132359&view=diff
==============================================================================
--- libcxx/trunk/include/array (original)
+++ libcxx/trunk/include/array Tue May 31 16:06:33 2011
@@ -34,28 +34,28 @@
// No explicit construct/copy/destroy for aggregate type
void fill(const T& u);
- void swap(array& a);
+ void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
// iterators:
- iterator begin();
- const_iterator begin() const;
- iterator end();
- const_iterator end() const;
-
- reverse_iterator rbegin();
- const_reverse_iterator rbegin() const;
- reverse_iterator rend();
- const_reverse_iterator rend() const;
-
- const_iterator cbegin() const;
- const_iterator cend() const;
- const_reverse_iterator crbegin() const;
- const_reverse_iterator crend() const;
+ iterator begin() noexcept;
+ const_iterator begin() const noexcept;
+ iterator end() noexcept;
+ const_iterator end() const noexcept;
+
+ reverse_iterator rbegin() noexcept;
+ const_reverse_iterator rbegin() const noexcept;
+ reverse_iterator rend() noexcept;
+ const_reverse_iterator rend() const noexcept;
+
+ const_iterator cbegin() const noexcept;
+ const_iterator cend() const noexcept;
+ const_reverse_iterator crbegin() const noexcept;
+ const_reverse_iterator crend() const noexcept;
// capacity:
- constexpr size_type size() const;
- constexpr size_type max_size() const;
- bool empty() const;
+ constexpr size_type size() const noexcept;
+ constexpr size_type max_size() const noexcept;
+ bool empty() const noexcept;
// element access:
reference operator[](size_type n);
@@ -68,8 +68,8 @@
reference back();
const_reference back() const;
- T* data();
- const T* data() const;
+ T* data() noexcept;
+ const T* data() const noexcept;
};
template <class T, size_t N>
@@ -86,15 +86,15 @@
bool operator>=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N >
- void swap(array<T,N>& x, array<T,N>& y);
+ void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
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>&);
-template <int I, class T, size_t N> const T& get(const array<T, N>&);
-template <int I, class T, size_t N> T&& get(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;
} // std
@@ -137,29 +137,45 @@
// No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
{_STD::fill_n(__elems_, _Size, __u);}
- _LIBCPP_INLINE_VISIBILITY void swap(array& __a)
+ _LIBCPP_INLINE_VISIBILITY
+ void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
{_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
// iterators:
- _LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__elems_);}
- _LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(__elems_);}
- _LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__elems_ + _Size);}
- _LIBCPP_INLINE_VISIBILITY const_iterator end() const {return const_iterator(__elems_ + _Size);}
-
- _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
- _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() {return reverse_iterator(begin());}
- _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
-
- _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const {return begin();}
- _LIBCPP_INLINE_VISIBILITY const_iterator cend() const {return end();}
- _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const {return rbegin();}
- _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const {return rend();}
+ _LIBCPP_INLINE_VISIBILITY
+ iterator begin() _NOEXCEPT {return iterator(__elems_);}
+ _LIBCPP_INLINE_VISIBILITY
+ const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
+ _LIBCPP_INLINE_VISIBILITY
+ iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
+ _LIBCPP_INLINE_VISIBILITY
+ const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
+
+ _LIBCPP_INLINE_VISIBILITY
+ reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
+ _LIBCPP_INLINE_VISIBILITY
+ const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
+ _LIBCPP_INLINE_VISIBILITY
+ reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
+ _LIBCPP_INLINE_VISIBILITY
+ const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
+
+ _LIBCPP_INLINE_VISIBILITY
+ const_iterator cbegin() const _NOEXCEPT {return begin();}
+ _LIBCPP_INLINE_VISIBILITY
+ const_iterator cend() const _NOEXCEPT {return end();}
+ _LIBCPP_INLINE_VISIBILITY
+ const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
+ _LIBCPP_INLINE_VISIBILITY
+ const_reverse_iterator crend() const _NOEXCEPT {return rend();}
// capacity:
- _LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type size() const {return _Size;}
- _LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type max_size() const {return _Size;}
- _LIBCPP_INLINE_VISIBILITY bool empty() const {return _Size == 0;}
+ _LIBCPP_INLINE_VISIBILITY
+ /*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
+ _LIBCPP_INLINE_VISIBILITY
+ /*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
+ _LIBCPP_INLINE_VISIBILITY
+ bool empty() const _NOEXCEPT {return _Size == 0;}
// element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
@@ -172,8 +188,10 @@
_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 value_type* data() {return __elems_;}
- _LIBCPP_INLINE_VISIBILITY const value_type* data() const {return __elems_;}
+ _LIBCPP_INLINE_VISIBILITY
+ value_type* data() _NOEXCEPT {return __elems_;}
+ _LIBCPP_INLINE_VISIBILITY
+ const value_type* data() const _NOEXCEPT {return __elems_;}
};
template <class _Tp, size_t _Size>
@@ -254,6 +272,7 @@
_LIBCPP_INLINE_VISIBILITY inline
void
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
+ _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
{
__x.swap(__y);
}
@@ -283,7 +302,7 @@
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
_Tp&
-get(array<_Tp, _Size>& __a)
+get(array<_Tp, _Size>& __a) _NOEXCEPT
{
return __a[_Ip];
}
@@ -291,7 +310,7 @@
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
const _Tp&
-get(const array<_Tp, _Size>& __a)
+get(const array<_Tp, _Size>& __a) _NOEXCEPT
{
return __a[_Ip];
}
@@ -301,7 +320,7 @@
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
_Tp&&
-get(array<_Tp, _Size>&& __a)
+get(array<_Tp, _Size>&& __a) _NOEXCEPT
{
return _STD::move(__a[_Ip]);
}
More information about the cfe-commits
mailing list