Home Help Center

Can I use Ice's smart pointer with my own type?

Ice has a cool smart pointer implementation, with which we needn't care about memory allocation and deallocation any more. My problem is, can I use Ice's smart pointer with my own class which doesn't necessarily inherit from Ice::Object?

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Yes, you can use IceUtil::Shared for your own types, for example:
       class Base : public virtual IceUtil::Shared
       {
       };
       typedef IceUtil::Handle<Base> BasePtr;
    

    Benoit.
Sign In or Register to comment.