c++-climanaged-c++

What is the C++ CLI equivalent of managed c++'s __typeof and __gc?


I'm trying to convert an old c++ project from VS2003 to VS2019. Part of this, I'm learning, is going from managed C++ to C++ CLI as managed c++ was dropped pretty quickly.

I'm managing for the most part, but I can't seem to figure out what replaces the __typeof keyword. Is there a drop in for this? See below code snippet for context in how it was it's used.

private: System::ComponentModel::IContainer ^  components;

    private:
        void InitializeComponent(void)
        {
            this->components = gcnew System::ComponentModel::Container();
            System::Resources::ResourceManager ^  resources = gcnew System::Resources::ResourceManager(__typeof(USB::Form1));
            .
            .
            .
        }

Additionally, there's another reoccurring identifier, __gc , that I have found some more info on, but am not sure I understand what to replace it with.

Char chars __gc[] = gcnew Char __gc[bytes->Length * 2];
Char hexDigits __gc[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
bool ImageNumberUsed __gc[];

Does anyone have a good grasp on this and know what the proper conversions are given above contexts?


Solution

  • I can't say that I've used much Managed C++, but I can say what the C++/CLI equivalents are.