Hi everyone,
Instead of smart pointers is it not usually better to use something like:
Code:
Object obj = pool.get(memory_size);
//std::cout.write(static_cast<const char*>(obj.front()),memory_size);
And then get at least [memory_size] free aligned memory? Object class will then work exactly as a smart pointer, but instead of deleting the memory it just push it back to the pool and therefore can it be reused again. A summarize is smart pointers together with allocators.
It sounds of course that it should be more efficient, but if it should, why are it used so rarely?
Thanks in advance.