diff --git a/include/boost/container/detail/placement_new.hpp b/include/boost/container/detail/placement_new.hpp index 6d7ead8..0d3aa68 100644 --- a/include/boost/container/detail/placement_new.hpp +++ b/include/boost/container/detail/placement_new.hpp @@ -11,10 +11,15 @@ /////////////////////////////////////////////////////////////////////////////// #include +#include //BOOST_CONTAINER_RETURNS_NONNULL struct boost_container_new_t{}; //avoid including +//returns_nonnull lets the compiler drop the null check the new-expression +//otherwise performs on the result of this custom placement operator new; +//nonnull(2) tells it the passed pointer 'p' is never null either. +BOOST_CONTAINER_RETURNS_NONNULL BOOST_CONTAINER_NONNULL(2) inline void *operator new(std::size_t, void *p, boost_container_new_t) { return p; }