-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allocator_delete
does not support polymorphism
#33
Comments
I can't really implement it, because deallocation of custom allocators is not polymorphic. You see, when deallocating an object I need to know its size, which I don't know for a base class. What I could add is a I'm assuming you're having a container of |
If I understand ptr_vector allocator correctly, it uses the clonable
concept to deallocate objects in the container. This concept has no notion
of the size of elements, so I cannot glue in a raw allocator. I am willing
to incur the wasted memory caused by the allocator references as long as it
performs better in time than the standard allocator. So for my purposes, storing
the size in the deleter is probably acceptable.
The alternative would be a variant of commands, but in this case I am
willing to incur the virtual function call overhead to get extensibility.
|
Thanks! |
Cannot convert
std::unique_ptr<Game::KillShip, foonathan::memory::allocator_deleter<Game::KillShip, foonathan::memory::temporary_allocator, std::mutex>>
TO
std::unique_ptr<Game::EntityCommand, foonathan::memory::allocator_deleter<Game::EntityCommand, foonathan::memory::temporary_allocator, std::mutex>
where
Game::EntityCommand
is the base class ofGame::KillShip
The text was updated successfully, but these errors were encountered: