Added BOOST_CONTAINER_RETURNS_NONNULL and BOOST_CONTAINER_NONNULL to placement new

This commit is contained in:
Ion Gaztañaga
2026-06-03 19:26:17 +02:00
parent 6d7bc6e64d
commit f7488a2e4d
@@ -11,10 +11,15 @@
///////////////////////////////////////////////////////////////////////////////
#include <cstddef>
#include <boost/container/detail/workaround.hpp> //BOOST_CONTAINER_RETURNS_NONNULL
struct boost_container_new_t{};
//avoid including <new>
//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; }