Don't call deallocate with null pointers

This commit is contained in:
Daniel James
2017-12-17 12:16:08 +00:00
parent 65a6556800
commit 3dc4f33ad5

View File

@ -116,13 +116,15 @@ namespace boost
void operator()(value_type* ptr) const
{
if (!! ptr) ptr->~value_type();
if (!! ptr) {
ptr->~value_type();
#if defined(BOOST_NO_CXX11_ALLOCATOR)
const_cast<allocator_type*>(static_cast<allocator_type const*>(
this))->deallocate(ptr,1);
const_cast<allocator_type*>(static_cast<allocator_type const*>(
this))->deallocate(ptr,1);
#else
allocator_traits::deallocate(this->get_allocator(),ptr,1);
allocator_traits::deallocate(this->get_allocator(),ptr,1);
#endif
}
}
};