boost smart pointers with memory managers
Hi Is there a way to work with boost's smart pointers , for memory allocated by a memory manager ? I have a memory manager the pre allocates memory , and when i need new memory , i use the manager to supply it , and when i am finished, i return the memory to the memory manager . did i make my self clear ?. thanks shany
--- At Tue, 18 Mar 2003 17:57:53 +0000, shanypozin2003 wrote:
Hi Is there a way to work with boost's smart pointers , for memory allocated by a memory manager ? I have a memory manager the pre allocates memory , and when i need new memory , i use the manager to supply it , and when i am finished, i return the memory to the memory manager .
smart pointers are constructed with a pointer to allocated memory, so there isnt a need to worry about that. The problem is how to delete that data properly. smart pointers actually take an additional default parameter that is a deleter object. There are examples in the documentation or browse the sources to see how it works. You would write a deleter object that would return your memory to the memory manager and construct your smart pointers with an instance of that object. ...Duane
participants (2)
-
Duane Murphy
-
shanypozin2003