summaryrefslogtreecommitdiff
path: root/include/deque
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2011-06-03 15:16:49 +0000
committerHoward Hinnant <hhinnant@apple.com>2011-06-03 15:16:49 +0000
commit009b2c4583bcbfc5d0893154eb0866aa21b494cd (patch)
treeceba035dbe247f787c4362353460ac5dc509399a /include/deque
parent93f2764b165fdcf62f4424d919d4713c9d2dbab6 (diff)
After sleeping on it I've decided that all special members that can be noexcept, should be declared so. The client has the traits to detect and branch on this information, and it is often an important optimization. Give deque() a noexcept. Add test for deque default constructor and deque destructor.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132549 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/deque')
-rw-r--r--include/deque11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/deque b/include/deque
index a49205987..71fa7f845 100644
--- a/include/deque
+++ b/include/deque
@@ -38,7 +38,7 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy:
- deque();
+ deque() noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit deque(const allocator_type& a);
explicit deque(size_type n);
deque(size_type n, const value_type& v);
@@ -934,7 +934,8 @@ protected:
_LIBCPP_INLINE_VISIBILITY
const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();}
- __deque_base();
+ __deque_base()
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
explicit __deque_base(const allocator_type& __a);
public:
~__deque_base();
@@ -1072,6 +1073,7 @@ __deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
__deque_base<_Tp, _Allocator>::__deque_base()
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __start_(0), __size_(0) {}
template <class _Tp, class _Allocator>
@@ -1185,7 +1187,10 @@ public:
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy:
- _LIBCPP_INLINE_VISIBILITY deque() {}
+ _LIBCPP_INLINE_VISIBILITY
+ deque()
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
+ {}
_LIBCPP_INLINE_VISIBILITY deque(const allocator_type& __a) : __base(__a) {}
explicit deque(size_type __n);
deque(size_type __n, const value_type& __v);