Re: Synthesized ivar for std::tr1::shared_ptr<MyClass>?
Re: Synthesized ivar for std::tr1::shared_ptr<MyClass>?
- Subject: Re: Synthesized ivar for std::tr1::shared_ptr<MyClass>?
- From: Kyle Sluder <email@hidden>
- Date: Fri, 7 May 2010 12:01:30 -0700
On Fri, May 7, 2010 at 11:47 AM, Barry Wark <email@hidden> wrote:
> Your comment brings things into better focus; it appears that template
> instantiation is happening after the compiler attempts to synthesize
> the ivar and accessor methods. Again, my C++-foo is weak but I recall
> that template instantiation happens as a separate compilation step,
> no? Too bad; it's a shame to have to resort to allocating a shared_ptr
> on the heap just to play nicely with modern C++ code that's using RAII
> (including smart pointers) to manage memory.
My C++-foo is similarly weak, but this explanation seems logical if a
bit unfortunate. After all, nothing stops you from creating auto or
static variables of template type, right? So the compiler needs to
specialize templates as it compiles other code; @synthesize
declarations should be no different. Since Cocoa doesn't follow RAII
anyway, I'm not all that distressed.
Perhaps you could provide a public abstract class and hide the
C++-using implementation behind it? I can't think of another solution
that doesn't break the 32-bit runtime.
--Kyle Sluder
_______________________________________________
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