Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

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

Templates

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.