• 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: Using C++ AutoPtr within an Obj C file.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using C++ AutoPtr within an Obj C file.


  • Subject: Re: Using C++ AutoPtr within an Obj C file.
  • From: Anthony Byrne <email@hidden>
  • Date: Sat, 6 Aug 2005 09:35:43 -0500


On Aug 5, 2005, at 2:03 PM, email@hidden wrote:

I intend to use this C++ construct in my "init" method of my
"controller.mm" file.  Is this
permitted?


Well, it's permitted, but it will only create a local variable, not an ivar
of an Objective-C class...


so - you say I can use

auto_ptr<ClientAuthManager> clientAuth(new ClientAuthManager);

Where "clientAuth" is a local variable and not a ObjC "ivar"?

is that what you are saying?

That's what he is saying. To clarify, an auto_ptr object is created on the stack, not the heap. This makes it ideal for temporary use, where you know it will be properly disposed of in the event an exception is thrown.


I'm afraid I'm still much more comfortable with the C++ questions than the Cocoa ones. ;-)

Tony Byrne
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Name of data model file
  • Next by Date: Re: NSArrayControllers and sorting
  • Previous by thread: Re: Using C++ AutoPtr within an Obj C file.
  • Next by thread: Helper Tool Include Foundation Framework
  • Index(es):
    • Date
    • Thread