summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/array
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-16 18:09:17 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-16 18:09:17 +0000
commitcb17d4f27ce0a1c9f11eb9da3e2250b7591009cb (patch)
tree5719dd46ba98d097b18f3d0c21dd26d7d38d91b9 /libstdc++-v3/include/std/array
parent25d5a26358fc99f9f357592f6a54e646f833a94e (diff)
downloadgcc-cb17d4f27ce0a1c9f11eb9da3e2250b7591009cb.tar.gz
2011-05-16 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/utility (get(std::pair<>&&)): Add. * include/bits/stl_pair.h (pair::swap(pair&), swap(pair<>&, pair<>&)): Use noexcept. * include/bits/random.h (discard_block_engine<>::base, independent_bits_engine<>::base, shuffle_order_engine<>::base, random_device::entropy): Use noexcept. * include/std/array: Use noexcept where appropriate. (get(array<>&&)): Add. * testsuite/23_containers/array/requirements/get.cc: New. * testsuite/20_util/pair/get.cc: Likewise. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Tweak dg-error line number. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173798 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/array')
-rw-r--r--libstdc++-v3/include/std/array51
1 files changed, 29 insertions, 22 deletions
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index a0bdd24a85a..b0fc75b14bc 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -1,6 +1,6 @@
// <array> -*- C++ -*-
-// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -83,66 +83,67 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
swap(array& __other)
+ noexcept(noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>())))
{ std::swap_ranges(begin(), end(), __other.begin()); }
// Iterators.
iterator
- begin()
+ begin() noexcept
{ return iterator(std::__addressof(_M_instance[0])); }
const_iterator
- begin() const
+ begin() const noexcept
{ return const_iterator(std::__addressof(_M_instance[0])); }
iterator
- end()
+ end() noexcept
{ return iterator(std::__addressof(_M_instance[_Nm])); }
const_iterator
- end() const
+ end() const noexcept
{ return const_iterator(std::__addressof(_M_instance[_Nm])); }
reverse_iterator
- rbegin()
+ rbegin() noexcept
{ return reverse_iterator(end()); }
const_reverse_iterator
- rbegin() const
+ rbegin() const noexcept
{ return const_reverse_iterator(end()); }
reverse_iterator
- rend()
+ rend() noexcept
{ return reverse_iterator(begin()); }
const_reverse_iterator
- rend() const
+ rend() const noexcept
{ return const_reverse_iterator(begin()); }
const_iterator
- cbegin() const
+ cbegin() const noexcept
{ return const_iterator(std::__addressof(_M_instance[0])); }
const_iterator
- cend() const
+ cend() const noexcept
{ return const_iterator(std::__addressof(_M_instance[_Nm])); }
const_reverse_iterator
- crbegin() const
+ crbegin() const noexcept
{ return const_reverse_iterator(end()); }
const_reverse_iterator
- crend() const
+ crend() const noexcept
{ return const_reverse_iterator(begin()); }
// Capacity.
constexpr size_type
- size() const { return _Nm; }
+ size() const noexcept { return _Nm; }
constexpr size_type
- max_size() const { return _Nm; }
+ max_size() const noexcept { return _Nm; }
constexpr bool
- empty() const { return size() == 0; }
+ empty() const noexcept { return size() == 0; }
// Element access.
reference
@@ -186,11 +187,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return _Nm ? *(end() - 1) : *end(); }
_Tp*
- data()
+ data() noexcept
{ return std::__addressof(_M_instance[0]); }
const _Tp*
- data() const
+ data() const noexcept
{ return std::__addressof(_M_instance[0]); }
};
@@ -228,13 +229,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
- // Specialized algorithms [6.2.2.2].
+ // Specialized algorithms.
template<typename _Tp, std::size_t _Nm>
inline void
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
+ noexcept(noexcept(__one.swap(__two)))
{ __one.swap(__two); }
- // Tuple interface to class template array [6.2.2.5].
+ // Tuple interface to class template array.
/// tuple_size
template<typename _Tp>
@@ -258,12 +260,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
inline _Tp&
- get(array<_Tp, _Nm>& __arr)
+ get(array<_Tp, _Nm>& __arr) noexcept
{ return __arr[_Int]; }
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
+ inline _Tp&&
+ get(array<_Tp, _Nm>&& __arr) noexcept
+ { return std::move(get<_Int>(__arr)); }
+
+ template<std::size_t _Int, typename _Tp, std::size_t _Nm>
inline const _Tp&
- get(const array<_Tp, _Nm>& __arr)
+ get(const array<_Tp, _Nm>& __arr) noexcept
{ return __arr[_Int]; }
_GLIBCXX_END_NAMESPACE_VERSION