"Ioannis Vranos" <iv*@remove.this.grad.com> wrote
r is a handle. Handles are not managed types so you can use &r to take a
pointer to a handle of type R (R ^ *):
R ^r = gcnew R;
R ^ *o= &r;
This still does not work. I got the following error:
error C2143: syntax error : missing ';' before '}'
error C2373: 'o' : redefinition; different type modifiers
Your example seems to imply the abilty for C++/CLI to declare copy
constructors, and I don't think C++/CLI allows this. Here's a blog from
Stan Lippman about this:
http://blogs.msdn.com/slippman/archi.../20/60655.aspx
"The CLR reflects a different programming philosophy and tradition - think
of SmallTalk as a point of origin, although that is not deeply thought out.
However, in the the presence of garbage collection and intrinsic
polymorphism of managed reference types [with default shallow copy], the
entire copy constructor/copy operator mechanism is not really necessary - at
least in the opinion of the inventors of the CLR, and I tend to agree.
However, it is felt as a bereavement by native C++ programmers, and it is a
pattern of usage should one wish to chase the grail of transparent code that
compiles to either native or managed. It falls between the intrinsics of
multiple inheritance and that of deterministic finalization in my opinion as
to its importance in being simulated. "
Also, my assumption was that handles are managed types, since they are
allocated on the managed heap and later deallocated by the GC. The Lippman
blog seems to agree with this.
Anyway, my understanding of c++/cli is still raw, so I may be wrong.
-Don Kim