I have this code:
DispatcherTimer^ CalenderClock();
When I use *
instead of ^
visual studio tells me:
an ordinary pointer to C++\CX mapping ref class or inteface class is not allowed
what is the difference between ^
and *
pointers?
I have this code:
DispatcherTimer^ CalenderClock();
When I use *
instead of ^
visual studio tells me:
an ordinary pointer to C++\CX mapping ref class or inteface class is not allowed
what is the difference between ^
and *
pointers?
The handle-to-object operator ^ is known as a "hat" and is fundamentally a C++ smart pointer. The memory it points to is automatically destroyed when the last hat goes out of scope or is explicitly set to
nullptr
.
Source: https://learn.microsoft.com/en-us/cpp/cppcx/ref-classes-and-structs-c-cx (Found by googling your error message.)
Note that this syntax is non-standard. It is a Microsoft extension to the C++ language.