-1

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?

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
itai neria
  • 27
  • 8

1 Answers1

2

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.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268