double __gc * cast to double*

  • Thread starter Thread starter apm
  • Start date Start date
A

apm

All:

Can double __gc * be cast to a double*? In C# the fixed(double* pX = x) can
be used. Is there an equivalent in C++.NET?

Thanks in advance.

DTC
 
apm said:
Can double __gc * be cast to a double*? In C# the fixed(double* pX = x)
can be used. Is there an equivalent in C++.NET?

You should be able to use a pinning pointer to acheive the same result as
the cast, no?

// Double on the managed heap

System::Double __gc *pd1 = new System::Double(3.0);

// Get a pointer to a double which does not get moved/collected while in
scope

double __pin *pd2;

// Same net effect as cast?

pd2 = pd1;

Regards,
Will
 
Back
Top