Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Creating selectors to work around templates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating selectors to work around templates



Am 14.07.2011 um 14:32 schrieb Kelvin Chung:

>>> std::array<id, 3> threeIDs = {@"foo", @"bar", @"baz"};
>>
>> Why would you have a C++ array of ObjC objects in the first array?
>
> Because when I work with Obj-C++, I typically have to deal with incredibly awkward mixes of C++ objects and Objective-C objects.

I don't see why you would have those mixes, they won't work anyway. If you put ObjC objects in C++ classes like you did above, you break the reference counting anyway.

>> It's quite simple: If you want to store C++ "objects", use C++ classes. If you want to store ObjC objects, use ObjC classes.
>
> If I had to do that, then I'd pick one language over the other.  Objective-C++ has both, so I can use the benefits of both.


You had to pick one language over the other just because you use C++ classes to store C++ objects and ObjC classes to store ObjC objects? That sounds strange. You would not use an array in ObjC and create a class for boxing to store C++ objects either, so why do it the other way around?

It seems you misunderstood what ObjC++ is. ObjC++ is two separate langauges in the same file, ObjC and C++. They can't be mixed, because they are incompatible.

--
Jonathan

Attachment: PGP.sig
Description: Signierter Teil der Nachricht

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Creating selectors to work around templates (From: Kelvin Chung <email@hidden>)
 >Re: Creating selectors to work around templates (From: Jonathan Schleifer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.