user3103982
user3103982

Reputation: 101

C++ cli list of structs declaration Visual studio 2022

I have C++ non-managed code

namespace CPPWrapperClass {

struct RectSize
{
    int width;
    int height;
};

struct Rect
{
    int x;
    int y;
    int width;
    int height;
};
}

How to declare it as an array in managed code in CLI? CLI:

using namespace System;
using namespace System::Collections::Generic;
namespace CLI
{
    public ref class MaxRectsBinPack : public ManagedObject<CPPWrapperClass::MaxRectsBinPack>
    {
        std::vector<CPPWrapperClass::Rect> usedRectangles;//a member of a managed class cannot be of a non-managed class type
        List<CPPWrapperClass::Rect> usedRectangles;       //is not a valid generic argument
        How to initialize list of Rect ?
    }
}

How to initialize list of Rect ? Thanks in advance

Upvotes: 0

Views: 36

Answers (0)

Related Questions