mirror of
https://github.com/boostorg/container.git
synced 2026-07-08 04:40:50 +02:00
Added BOOST_CONTAINER_RETURNS_NONNULL and BOOST_CONTAINER_NONNULL to placement new
This commit is contained in:
@@ -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; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user