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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top