Advertisement Jump to content
Sign in to follow this  
Fish Fishes

Implement allocator

This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to implement an allocator for the list to use some piece of my code in element destructor. I mean, I want to run my code when allocator runs destroy() for the list element. I have tried to inherit default allocator, but I can't execute my method destroy(pointer) case its not virtual in base class. Any solvements? Or maybe I need to write whole allocator? Or best: how to implement my task?

Share this post


Link to post
Share on other sites
Advertisement
Allocator classes aren't designed to be inherited from. They contain typedefs. Unless you change those typedefs too, inheriting from the base allocator won't help you in the least.

What part of the implementation do you have trouble with?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I don't know from what to start writing an allocator.

I'm creating objects w/ new. After that I put there pointers into list. And when I'm deleting list's element, or when list is deleting I want that its destructor run delete for my objects.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!