What does ^ after a type mean in c++?

2019-06-17 04:29发布

问题:

I have some c++ code with function return types declared as string^ or IEnumerable<String^>^, what does that mean?

edits: c#->c++/cli

回答1:

It doesn't mean anything in C#. You're looking at source code for C++/CLI, not C#.

See http://en.wikipedia.org/wiki/C%2B%2B/CLI for a brief introduction.

The carat symbol basically means "this is a GC-tracked reference".



回答2:

It seems like managed C++, not C#. ^ means managed reference type.



回答3:

Nothing. It is not valid there in C++. It's a "managed reference" type modifier for C++/CLI, a distinct language.