On 08.11.2008, at 02:41, Jonathan Bailey wrote:

I am trying to find a way to create a dynamically-growable objective C
data structure within objective C++ code, such as a
NSMutableDictionary, that can store values that are pointers to an
objective C++ or straight-up C++ object.

Personally, I'd use the PIMPL idiom + std::map. It avoids the mess only ObjC++ sources can include foo.h.

foo.h:

@class Foo
{
        struct FooPriv *priv_;
};

foo.mm:

struct
{
        std::map<int, boost::shared_ptr<CppBaseClass> > value_map;
} FooPriv;

- (id) init
{
        if( self = [super init] )
        {
                priv_ = new FooPriv();
        }
}

- (void) dealloc
{
        delete priv_;
        [super dealloc];
}

etc...


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to