
"Larry Evans" <cppljevans@cox-internet.com> wrote in message news:dq36jf$7c0$1@sea.gmane.org...
On 01/11/2006 08:27 AM, Achilleas Margaritis wrote: [snip]
------------------------------------------------------- Alternative 1 - using gc_ptr<T> for global, stack and member pointers.
It is possible to use the gc_ptr class for global, stack and member pointers. The class would have to check if it belongs in the last-known created object by checking its address against the address of the last created object. If the pointer falls within the memory area of the last created object, then it is a member pointer, otherwise it is a global/stack pointer. Example code:
template < class T > class gc_ptr { public: gc_ptr() { if this not within last created object then {
This test, IIUC, requires access to a global object (pointer to last created object or something similar). Wouldn't this then require synchronization between threads; hence, cause a big slowdown for each gc_ptr creation?
If the pointer stack is thread-specific storage, then synchronization is not be needed.
pointer stack->push(this); } } };
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost