|
Boost : |
Subject: Re: [boost] BOOST_NO_EXTERN_TEMPLATE
From: John Maddock (boost.regex_at_[hidden])
Date: 2010-05-27 04:40:51
> 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_macro_reference.html
Oh :-(
Will fix,
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk