typeof Goes to T::typeid

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at typeof Goes to T::typeid.

The typeof operator used in Managed Extensions for C++ has been supplanted by the typeid keyword in Visual C++.

In Managed Extensions, the __typeof() operator returns the associated Type* object when passed the name of a managed type. For example:

// Creates and initializes a new Array instance.  
Array* myIntArray =   
   Array::CreateInstance( __typeof(Int32), 5 );  

In the new syntax, __typeof has been replaced by an additional form of typeid that returns a Type^ when a managed type is specified.

// Creates and initializes a new Array instance.  
Array^ myIntArray =   
   Array::CreateInstance( Int32::typeid, 5 );  

See Also

General Language Changes (C++/CLI)
typeid