• 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: Xcode 5 & Obj-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Xcode 5 & Obj-C++
      • From: koko <email@hidden>
References: 
 >Xcode 5 & Obj-C++ (From: Peter Teeson <email@hidden>)

  • Prev by Date: Re: Layer needs display if presentation layer moves?
  • Next by Date: Re: Preserving undo actions on deleted targets
  • Previous by thread: Re: Xcode 5 & Obj-C++
  • Next by thread: Re: Xcode 5 & Obj-C++
  • Index(es):
    • Date
    • Thread