A lot of clear-related functions rely on allocator_traits::destroy/deallocate, and are marked as noexcept (either required by standard or strengethened). Examples are many and are not listed here (search ::deallocate and ::destroy in the library).
However:
allocator_traits is either _Default_allocator_traits or _Normal_allocator_traits.
|
struct allocator_traits : conditional_t<_Is_default_allocator<_Alloc>::value, _Default_allocator_traits<_Alloc>,
|
|
_Normal_allocator_traits<_Alloc>> {};
|
But currently:
_Default_allocator_traits: deallocate is marked as noexcept; but destroy is not.
deallocate: made noexcept by #4977
|
static _CONSTEXPR20 void deallocate(_Alloc& _Al, const pointer _Ptr, const size_type _Count) noexcept
|
destroy: not noexcept.
|
static _CONSTEXPR20 void destroy(_Alloc&, _Uty* const _Ptr) {
|
_Normal_allocator_traits: neither deallocate nor destroy are noexcept.
deallocate:
|
static _CONSTEXPR20 void deallocate(_Alloc& _Al, pointer _Ptr, size_type _Count) {
|
destroy:
|
static _CONSTEXPR20 void destroy(_Alloc& _Al, _Ty* _Ptr) {
|
A lot of clear-related functions rely on
allocator_traits::destroy/deallocate, and are marked as noexcept (either required by standard or strengethened). Examples are many and are not listed here (search::deallocateand::destroyin the library).However:
allocator_traitsis either_Default_allocator_traitsor_Normal_allocator_traits.STL/stl/inc/xmemory
Lines 759 to 760 in 313964b
But currently:
_Default_allocator_traits:deallocateis marked asnoexcept; butdestroyis not.deallocate: madenoexceptby #4977STL/stl/inc/xmemory
Line 717 in 313964b
destroy: not noexcept.STL/stl/inc/xmemory
Line 741 in 313964b
_Normal_allocator_traits: neitherdeallocatenordestroyare noexcept.deallocate:STL/stl/inc/xmemory
Line 610 in 313964b
destroy:STL/stl/inc/xmemory
Line 628 in 313964b