• 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: Objective C++, C++, and templates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective C++, C++, and templates


  • Subject: Re: Objective C++, C++, and templates
  • From: Jim Crafton <email@hidden>
  • Date: Fri, 4 Jul 2003 13:32:41 -0400

On Friday, July 4, 2003, at 01:05 PM, Jim Crafton wrote:

Hi all,
I have some C++ template code that I have residing in a number of headers
I have an Objective C++ file that includes these headers and if I compile the source file with the .mm (as Objective C++) I get a heap of bizarre errors, I think related to not understanding the template code. If I save the source file as .cpp (C++ Source file) and build all is well. Is there some issue in pulling in headers with templated code with Objective C++ ? I have not run into this before and I have other code in my framework that uses C++ templates and Objective C++ and compiles fine.

I am using Project Builder with GCC 3.1 (*not* using the Dec 2002 updates).


Ackkk
I found the problem
template <class Foo>
class A {

};
this will cause a problem with Objective C++
change it to
template <typename Foo>
class A {

};
and everything is hunky dory!
Sorry to bother folks!

Cheers

Jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Basic NSGraphicsContext question
      • From: Jim Crafton <email@hidden>
References: 
 >Objective C++, C++, and templates (From: Jim Crafton <email@hidden>)

  • Prev by Date: Re: awakeFromNib and windowWillLoad : basic question
  • Next by Date: Re: awakeFromNib and windowWillLoad : basic question
  • Previous by thread: Objective C++, C++, and templates
  • Next by thread: Basic NSGraphicsContext question
  • Index(es):
    • Date
    • Thread