简体   繁体   中英

I see many examples of C++ with the use of “Foo ^ bar” - what is “^”?

Is that .NET related? It appears to be a pointer of some sort, what is the difference?

Edit:

I actually know it is the XOR operator, but look at this example from this page.

void objectCollection() {
    using namespace System::Collections;

    **ArrayList ^as = gcnew ArrayList;**

    //... }

What is this?

Thanks.

I'm assuming that you're looking at constructs of the form:

Foo ^bar = gcnew Foo();

You're right, in .NET it is a pointer-"like" type and is part of C++/CLI, not but not standard ISO C++.

It's a reference to a garbage-collected, managed .NET object as opposed to a regular, unmanaged C++ object.

As the other poster suggest, outside the .NET world or in a non-object creation context, it is the XOR operator.

在C ++中,这是XOR运算符。

I actually know it is the XOR operator, but look at this example from this page .

void objectCollection()
{
    using namespace System::Collections;

    **ArrayList ^as = gcnew ArrayList;**

    //...
}

What is this?

That's a handle to a .NET reference type, when using Managed C++. See this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM