Differences from Other Implementations
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Differences from Other Implementations

The following list shows some differences between Microsoft C++ and other compilers.

  • The compiler cannot instantiate a template outside of the module in which it is defined. Visual C++.NET does not support the export keyword.

  • Templates cannot be used with functions declared with __declspec (dllimport) or __declspec (dllexport).

  • All template arguments must be of an unambiguous type that exactly matches that of the template parameter list. For example:

    template< class T > T check( T );
    template< class S > void watch( int (*)(S) );
    watch( check );     //error

    The compiler should instantiate the check templated function in the form int check( int ), but the inference cannot be followed.

  • When resolving names used in class templates or function templates, all names are treated as dependent names. See Name Resolution for Dependent Types

  • In a class template, the template parameter can be redefined in the scope of the class definition. See Name Resolution for Locally Declared Names

Other Resources


© 2015 Microsoft