Search code examples
c++-cligeneric-collections

What is the caret (^) for in a generic template in C++?


I see this code in c++ template examples:

void Main(array<String^>^ args)

but I don't understand the reason for the ^ terminating the String and closing angle bracket.

Is it to allow multiple types or something? If someone could someone straighten me out, I would appreciate it. Thanks!


Solution

  • This code is C++/CLI (C++ .NET). String^ is the equivalent of the String class in C#. It's different from std::string. Furthermore, array is a C++/CLI specific class (it's not a standard STL container).