Re: Xcode 5 & Obj-C++
Re: Xcode 5 & Obj-C++
- Subject: Re: Xcode 5 & Obj-C++
- From: Jens Alfke <email@hidden>
- Date: Wed, 29 Jan 2014 12:48:27 -0800
On Jan 29, 2014, at 9:02 AM, Peter Teeson <email@hidden> wrote:
> I understand that the file extension needs to be .mm to mix Obj-C and C++.
> But other than a command line template, which is for C++, there does not seem to be one for ObjC++.
It's honestly not any different. You're writing Objective-C code but you can use all of the extensions that C++ adds. (Or alternatively, you're writing C++ code but you can use Objective-C types and message objects. It depends on your use case.)
So for example you have an Objective-C class that wants to use std::vector. Cool, just add "#include <vector>", then use std::vector wherever you want.
Just avoid using C++ syntax or types in the class header, otherwise you won't be able to #import it from any non-Obj-C++ source files. (Or alternatively you could just make all of your source files use Obj-C++.)
—Jens
_______________________________________________
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