Re: Using C++ AutoPtr within an Obj C file.
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