noexcept for <scoped_allocator>.

llvm-svn: 132266
This commit is contained in:
Howard Hinnant 2011-05-28 18:51:12 +00:00
parent d53d81522d
commit cfd52789dc
1 changed files with 51 additions and 48 deletions

View File

@ -49,24 +49,25 @@ public:
scoped_allocator_adaptor();
template <class OuterA2>
scoped_allocator_adaptor(OuterA2&& outerAlloc,
const InnerAllocs&... innerAllocs);
scoped_allocator_adaptor(const scoped_allocator_adaptor& other);
const InnerAllocs&... innerAllocs) noexcept;
scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept;
scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other);
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other);
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
~scoped_allocator_adaptor();
inner_allocator_type& inner_allocator();
const inner_allocator_type& inner_allocator() const;
inner_allocator_type& inner_allocator() noexcept;
const inner_allocator_type& inner_allocator() const noexcept;
outer_allocator_type& outer_allocator();
const outer_allocator_type& outer_allocator() const;
outer_allocator_type& outer_allocator() noexcept;
const outer_allocator_type& outer_allocator() const noexcept;
pointer allocate(size_type n);
pointer allocate(size_type n, const_void_pointer hint);
void deallocate(pointer p, size_type n);
void deallocate(pointer p, size_type n) noexcept;
size_type max_size() const;
template <class T, class... Args> void construct(T* p, Args&& args);
@ -83,18 +84,20 @@ public:
void construct(pair<T1, T2>* p, pair<U, V>&& x);
template <class T> void destroy(T* p);
scoped_allocator_adaptor select_on_container_copy_construction() const;
template <class T> void destroy(T* p) noexcept;
scoped_allocator_adaptor select_on_container_copy_construction() const noexcept;
};
template <class OuterA1, class OuterA2, class... InnerAllocs>
bool
operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
template <class OuterA1, class OuterA2, class... InnerAllocs>
bool
operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
} // std
@ -182,7 +185,7 @@ private:
protected:
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() {}
__scoped_allocator_storage() _NOEXCEPT {}
template <class _OuterA2,
class = typename enable_if<
@ -190,7 +193,7 @@ protected:
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs)
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)),
__inner_(__innerAllocs...) {}
@ -200,7 +203,7 @@ protected:
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other)
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
: outer_allocator_type(__other.outer_allocator()),
__inner_(__other.inner_allocator()) {}
@ -210,7 +213,7 @@ protected:
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other)
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: outer_allocator_type(_STD::move(__other.outer_allocator())),
__inner_(_STD::move(__other.inner_allocator())) {}
@ -220,27 +223,27 @@ protected:
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __o,
const inner_allocator_type& __i)
const inner_allocator_type& __i) _NOEXCEPT
: outer_allocator_type(_STD::forward<_OuterA2>(__o)),
__inner_(__i)
{
}
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() {return __inner_;}
inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const {return __inner_;}
const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator()
outer_allocator_type& outer_allocator() _NOEXCEPT
{return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const
const outer_allocator_type& outer_allocator() const _NOEXCEPT
{return static_cast<const outer_allocator_type&>(*this);}
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
_LIBCPP_INLINE_VISIBILITY
select_on_container_copy_construction() const
select_on_container_copy_construction() const _NOEXCEPT
{
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
(
@ -263,14 +266,14 @@ protected:
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() {}
__scoped_allocator_storage() _NOEXCEPT {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc)
__scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)) {}
template <class _OuterA2,
@ -279,7 +282,7 @@ protected:
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2>& __other)
const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
: outer_allocator_type(__other.outer_allocator()) {}
template <class _OuterA2,
@ -288,33 +291,33 @@ protected:
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2>&& __other)
__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
: outer_allocator_type(_STD::move(__other.outer_allocator())) {}
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator()
inner_allocator_type& inner_allocator() _NOEXCEPT
{return static_cast<inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const
const inner_allocator_type& inner_allocator() const _NOEXCEPT
{return static_cast<const inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator()
outer_allocator_type& outer_allocator() _NOEXCEPT
{return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const
const outer_allocator_type& outer_allocator() const _NOEXCEPT
{return static_cast<const outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor<outer_allocator_type>
select_on_container_copy_construction() const
select_on_container_copy_construction() const _NOEXCEPT
{return scoped_allocator_adaptor<outer_allocator_type>(
allocator_traits<outer_allocator_type>::
select_on_container_copy_construction(outer_allocator())
);}
__scoped_allocator_storage(const outer_allocator_type& __o,
const inner_allocator_type& __i);
const inner_allocator_type& __i) _NOEXCEPT;
template <class...> friend class __scoped_allocator_storage;
};
@ -343,7 +346,7 @@ struct __outermost
{
typedef _Alloc type;
_LIBCPP_INLINE_VISIBILITY
type& operator()(type& __a) const {return __a;}
type& operator()(type& __a) const _NOEXCEPT {return __a;}
};
template <class _Alloc>
@ -355,7 +358,7 @@ struct __outermost<_Alloc, true>
>::type _OuterAlloc;
typedef typename __outermost<_OuterAlloc>::type type;
_LIBCPP_INLINE_VISIBILITY
type& operator()(_Alloc& __a) const
type& operator()(_Alloc& __a) const _NOEXCEPT
{return __outermost<_OuterAlloc>()(__a.outer_allocator());}
};
@ -403,14 +406,14 @@ public:
};
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor() {}
scoped_allocator_adaptor() _NOEXCEPT {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs)
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
: base(_STD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
template <class _OuterA2,
@ -419,7 +422,7 @@ public:
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other)
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
: base(__other) {}
template <class _OuterA2,
class = typename enable_if<
@ -427,23 +430,23 @@ public:
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other)
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: base(_STD::move(__other)) {}
// ~scoped_allocator_adaptor() = default;
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator()
inner_allocator_type& inner_allocator() _NOEXCEPT
{return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const
const inner_allocator_type& inner_allocator() const _NOEXCEPT
{return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator()
outer_allocator_type& outer_allocator() _NOEXCEPT
{return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const
const outer_allocator_type& outer_allocator() const _NOEXCEPT
{return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY
@ -456,7 +459,7 @@ public:
allocate(outer_allocator(), __n, __hint);}
_LIBCPP_INLINE_VISIBILITY
void deallocate(pointer __p, size_type __n)
void deallocate(pointer __p, size_type __n) _NOEXCEPT
{allocator_traits<outer_allocator_type>::
deallocate(outer_allocator(), __p, __n);}
@ -479,7 +482,7 @@ public:
}
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor select_on_container_copy_construction() const
scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
{return base::select_on_container_copy_construction();}
private:
@ -490,7 +493,7 @@ private:
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __o,
const inner_allocator_type& __i)
const inner_allocator_type& __i) _NOEXCEPT
: base(_STD::forward<_OuterA2>(__o), __i) {}
template <class _Tp, class... _Args>
@ -542,7 +545,7 @@ template <class _OuterA1, class _OuterA2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
const scoped_allocator_adaptor<_OuterA2>& __b)
const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT
{
return __a.outer_allocator() == __b.outer_allocator();
}
@ -551,7 +554,7 @@ template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b)
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT
{
return __a.outer_allocator() == __b.outer_allocator() &&
__a.inner_allocator() == __b.inner_allocator();
@ -561,7 +564,7 @@ template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b)
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT
{
return !(__a == __b);
}