Correct way of implementing placement new in C++

Viewed 1458

I have implemented the placement new like this:

inline void* operator new (std::size_t n, void* ptr) {return ptr;};

The environment I use has no standard library so I need placement new. The syntax for using this placement new operator should look like this:

::new (pointer) int(); 

For what reason do I need the size? My std::size_t is unsigned int. The reason why I do this is because there is no dynamic memory allocation available and I get all the pointers from a pool.

1 Answers
Related