B
Brian Genisio
Hi all,
I am developing some software, that creates a tree of information. For
each node, currently I am overriding the new operator, because it is a
requirement that after initialization, no new memory may be allocated.
It also needs to be thread safe, and each thread has a context, so any
allocation of nodes currently looks like this:
new (context) Node(...);
My allocator uses the context to keep memory from different threads safe.
I want to use STL, and write a custom allocator template for passing to
the STL containers (map and vector specifically).
The only problem, is that I need to figure out a way to have the STL use
the context as well, when it calls the allocator. I cant figure out a
way to tell the custom STL allocator to have a custom parameter stored
in the class before container initialization.
Any ideas?
Brian
I am developing some software, that creates a tree of information. For
each node, currently I am overriding the new operator, because it is a
requirement that after initialization, no new memory may be allocated.
It also needs to be thread safe, and each thread has a context, so any
allocation of nodes currently looks like this:
new (context) Node(...);
My allocator uses the context to keep memory from different threads safe.
I want to use STL, and write a custom allocator template for passing to
the STL containers (map and vector specifically).
The only problem, is that I need to figure out a way to have the STL use
the context as well, when it calls the allocator. I cant figure out a
way to tell the custom STL allocator to have a custom parameter stored
in the class before container initialization.
Any ideas?
Brian