BOOST_NO_EXTERN_TEMPLATE

Hi, Boost.Config defines the macro BOOST_NO_EXTERN_TEMPLATE, which probably [1] refers to suppressing the instantiation of a template using the "extern" keyword. This is part of the C++0x draft but has long been implemented by several compilers, including MSVC[2] and GCC[3]. BOOST_NO_EXTERN_TEMPLATE is still defined for both compilers, why is that? do those implementations differ from the proposed C++0x behaviour[4], so the macro is defined because it refers to a C++0x feature? Or is this a bug? Is using "extern template" recommended for boost libraries (under construction)? specifically, the library lends itself to seperate precompiled source and started out as such, but making it more configurable turned seperate source code into templates and increased compile time. the default use case (which was the only use case before) could still be compiled seperately if "extern template" is available. [1] the documentation says the macro indicates no support for explicit instantiation. I assume this is a documentation bug, because of its name and it's listed as a C++0x feature: http://www.boost.org/doc/libs/1_43_0/libs/config/doc/html/boost_config/boost... [2] http://msdn.microsoft.com/en-us/library/by56e477.aspx [3] http://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.html [4] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm

Boost.Config defines the macro BOOST_NO_EXTERN_TEMPLATE, which probably [1] refers to suppressing the instantiation of a template using the "extern" keyword. This is part of the C++0x draft but has long been implemented by several compilers, including MSVC[2] and GCC[3]. BOOST_NO_EXTERN_TEMPLATE is still defined for both compilers, why is that? do those implementations differ from the proposed C++0x behaviour[4], so the macro is defined because it refers to a C++0x feature? Or is this a bug?
There was a bug in the original test case that was committed for this C++0x feature that resulted in the macro being set for all current compilers, that was recently fixed in Trunk, it just hasn't made it to the release branch yet.
Is using "extern template" recommended for boost libraries (under construction)? specifically, the library lends itself to seperate precompiled source and started out as such, but making it more configurable turned seperate source code into templates and increased compile time. the default use case (which was the only use case before) could still be compiled seperately if "extern template" is available.
Sure, Boost.Regex has done that for a long time. FYI though the feature seems to be flaky with some compilers: I'm currently stuggling to make non trivial cases work with the Intel compiler for example :-(
[1] the documentation says the macro indicates no support for explicit instantiation. I assume this is a documentation bug, because of its name and it's listed as a C++0x feature: http://www.boost.org/doc/libs/1_43_0/libs/config/doc/html/boost_config/boost...
Oh :-( Will fix, John.

[1] the documentation says the macro indicates no support for explicit instantiation. I assume this is a documentation bug, because of its name and it's listed as a C++0x feature: http://www.boost.org/doc/libs/1_43_0/libs/config/doc/html/boost_config/boost...
Actually the docs were correct, in that they use the same terminology as the std: an "explicit instantiation declaration" is one beginning with "extern", as opposed to an "explicit instantiation definition" which actually does the instantiation. I'll change it slightly to try and make this clearer. John.
participants (2)
-
John Maddock
-
Stefan Strasser