On Sat, Nov 8, 2008 at 4:07 AM, Paul Thomas <[EMAIL PROTECTED]> wrote:
>
> On 8 Nov 2008, at 05:12, Jonathan Bailey wrote:
>
>> Hi Michael -
>>
>> Thanks much for your response. I actually did originally intend to use
>> an STL map, but I couldn't get it to work. It seemed that when I added
>> a C++ object to a map declared as an instance variable within my
>> ObjC++ class's header file, this generated an "EXC_BAD_ACCESS" signal
>> - and no exception thrown. As a test, I created a temp STL map in the
>> implementation/.mm file for this class, and added my C++ object to
>> that map and it seemed to work fine. So I assumed that templated
>> classes weren't supported as instance variables for an ObjC++ class.
>
> This sounds like you need to check the GCC_OBJC_CALL_CXX_CDTORS option in
> your build settings. Also called "Call C++ Default Ctors/Dtors in
> Objective-C"

Bingo. As an alternative (although I'm not really sure why you'd need
an alternative...) you can declare a *pointer to* a C++ object as an
ivar, then new/delete it in your init/dealloc methods.

Mike
_______________________________________________

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