哪个编译器支持函数模板分离编译模型(支持export)
- C/C++ code
//Test.htemplate<typename T>T GetTest(T n);//不要告诉我在这里用一句 #include "Test.cpp"//不要包含编译模型//Test.cppexport template<typename T> //VS2010和g++ 4.6.2都不支持 exportT TYCppStdLib::GetTest(T n) //是真的不支持还是需要开启某个编译选项{ //就像g++支持C++11要开启编译选项 -std=c++11 一样 return (-n);}//main.cpp#include "Test.h"int main(){ std::cout<<GetTest(10); return 0;}[解决办法]
Intel parallel studio 2011 XE , update 至最新补丁
支持的。
export
Enables support for the C++ export template feature. This is a deprecated option.
IDE Equivalent
None
Architectures
IA-32, Intel® 64 architectures
Syntax
Linux and Mac OS X:
-export
Windows:
None
Arguments
None
Default
OFF
The export template feature is not enabled.
Description
This option enables support for the C++ export template feature. This option is supported only in C++ mode.
Alternate Options
None
Parent topic: Language Options
See Also
export-dir compiler option
[解决办法]
Intel parallel studio 支持众多标准
c89
Conforms to the ISO/IEC 9899:1990 International Standard.
c99
Conforms to The ISO/IEC 9899:1999 International Standard.
c9x
This value is equivalent to specifying value c99.
gnu89
Conforms to ISO C90 plus GNU* extensions.
gnu99
Conforms to ISO C99 plus GNU* extensions.
gnu++98
Conforms to the 1998 ISO C++ standard plus GNU extensions.
c++0x
Enables support for the following C++0x features:
gnu++0x
This value is equivalent to specifying value c++0x.
不像某些至今仍不支持C99的编译器