#24 Refcounted pointer discovers embedded counts

open
nobody
None
5
2006-11-10
2006-11-10
Lee G.
No

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).

Discussion

  • Lee G.

    Lee G. - 2006-11-10

    implementation

     
  • Richard Sposato

    Richard Sposato - 2006-11-10

    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

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks