What is an array <T ^> ^ T in C ++ and how to extract values ​​from an array?

I am passing an array of C # objects to a managed C ++ DLL. The C # class is defined as follows:

  public class LatLonPointType
    {

        public double Lat;       // Latitude.
        public double Lon;       // Longitude.
    }

I am passing an array of LatLonPointTypes for a function in a managed C ++ DLL. As a result of trial and error, I found that I can pass this to a C ++ function using a function argument declared as:

 array <LatLonPointType^> ^PolygonPoints

The following C ++ code will retrieve an element of type LatLonPointType ^.

LatLonPointType ^a = PolygonPoints[0];

My questions:

  • I used C ++ a few years ago, it looks like a reference declaration &. Is there a good reference to ^?

  • In the above example, how would I convert the value (LatLonPointType ^) to the value (LatLonPointType)?

To clarify:

If I have:

LatLonPointType ^a = PolygonPoints[i];

How do I get a.Lat and a.Lon?

Is it possible to use a-> Lat and a-> Lon?

+4
1

, aka ^, , , . , new, :

Object* obj = new Object();

, :

MObject^ mobj = gcnew MObject();

, , , . .

, Lon, :

//Get method
double i = PolygonPoints[n]->Lon;
//Set method
PolygonPoints[n]->Lon = number;
0

Source: https://habr.com/ru/post/1653526/


All Articles