The basic Idea is that there should be a policy for ref
counted pointers that looks to see if the pointer to
type inherits an embedded counter, if it does then the
policy automatically switches to the embedded ref
counter type, otherwise it uses an external count by
default. I have already implemented this myself and it
is typesafe and works well. The attached code is the
basic implementation. It should compile and work as is
but I haven't tested it (my source has a little bit
more that Loki doesn't need).
implementation
Logged In: YES
user_id=749922
I looked through the loki.h file, and I noticed the
RefCountEmbed was very similar to the COMRefCounted policy
class in SmartPtr.h. In fact, I failed to see a significant
difference between the two. Hence, I'm thinking
RefCountEmbed is not needed. (Which also implies EmbedProxy
and EmbedRef are not needed either.)
The RefFather class seems interesting in that the compiler
selects the parent class. I wonder if that by itself can go
into SmartPtr.h. (I'd also like to know if a more generic
version of that could go into TypeManip.h where I could pass
any two types, and the compiler decides which one is the
parent class.)
> It should compile and work as is but I haven't tested it.
I strongly recommend compiling and testing code before
submitting it.
Cheers,
Rich