Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Differences from Other Implementations

Microsoft Specific

The following list shows some differences between Microsoft C++ and other compilers. Note that this list will change in future versions of the compiler.

  • The compiler cannot instantiate a template outside of the module in which it is defined.
  • 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.

  • Friend functions must be declared before they are used in a templated class. You cannot have a friend function defined within a class definition. This is because the friend function could be a templated function, which would cause an illegal nested template definition.

END Microsoft Specific

See Also


© 2015 Microsoft