Reputation: 502
C++ CLR, in Visual Studio 2010 (C++).
I have this struct:
value struct Triangle{
static array<int>^ v = gcnew array<int>(3);
static array<int>^ t = gcnew array<int>(3);
static array<int>^ n = gcnew array<int>(3);
};
and I declare the following in "private" section of my class:
static array<Triangle^>^ triangles = gcnew array<Triangle>(MAX_POLYGONS);
I get this error and I have no idea what it means (because it seems to contradict itself):
error C2440: 'initializing' : cannot convert from 'cli::array<Type> ^' to 'cli::array<Type> ^'
with
[
Type=Triangle
]
Evidently it doesn't like the struct. Should I be using ref instead of value? That produces a lot of pointers. Any push into the correct direction would be appreciated.
Upvotes: 1
Views: 1872
Reputation: 17444
You just have an extra hat (^) in your statement. It should read:
static array<Triangle>^ triangles = gcnew array<Triangle>(MAX_POLYGONS);
Upvotes: 5