• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ObjC data structure for C++/ObjC++ objects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC data structure for C++/ObjC++ objects?


  • Subject: Re: ObjC data structure for C++/ObjC++ objects?
  • From: "Michael Ash" <email@hidden>
  • Date: Sat, 8 Nov 2008 08:09:24 -0500

On Sat, Nov 8, 2008 at 4:07 AM, Paul Thomas <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >ObjC data structure for C++/ObjC++ objects? (From: "Jonathan Bailey" <email@hidden>)
 >Re: ObjC data structure for C++/ObjC++ objects? (From: "Michael Ash" <email@hidden>)
 >Re: ObjC data structure for C++/ObjC++ objects? (From: "Jonathan Bailey" <email@hidden>)
 >Re: ObjC data structure for C++/ObjC++ objects? (From: Paul Thomas <email@hidden>)

  • Prev by Date: Re: Spin Progress Indicator is not spinning
  • Next by Date: Layered back OpenGL view performance on Macbook and Mini
  • Previous by thread: Re: ObjC data structure for C++/ObjC++ objects?
  • Next by thread: Re: ObjC data structure for C++/ObjC++ objects?
  • Index(es):
    • Date
    • Thread