
12 Jan
2010
12 Jan
'10
5:36 p.m.
strasser@uni-bremen.de wrote:
I guess this was the reason to introduce a "key" in the first place? a similar behaviour could be implemented using the vector-technique. the key would have to be stored in the vector at the allocated index along with the pointer so thread_specific_ptr::get() can decide if the pointer is left-over from a previous thread_specific_ptr or an actual pointer belonging to this thread_specific_ptr, and reset() can destroy it.
This works (at the expense of doubling the vector size, but it would still beat a map). You'd also need the old cleanup function though.