From: Christoph Ludwig (cludwig_at_[hidden])
Date: 2005-06-29 07:35:39
On Wed, Jun 29, 2005 at 12:59:57PM +0100, John Maddock wrote:
> > Umm, now I'm confused. Why is explicit instantiation in more than one
> > translation unit illegal?
> I think I must be loosing it.... I can't find any such prohibition
> anywhere.... I was so sure that I'd had problems with this in the past as
You are referring to the explicit instantiation of the same template
specialization in several TUs, aren't you?
That is indeed prohibited. I am too lazy to look for chapter and verse in my
copy of the standard but Vandevoorde and Josuttis write in "C++ Templates. The
There should be, at most, one explicit instantiation of each distinct entity
in a program. [...] Not following this rule usually results in linker errors
that report duplicate definitions of the instantiated entities.
The standard also specifies that there can be at most one explicit
instantiation of a certain template specialization in a
program. Furthermore, if a template specialization is explicitly
instantiated, it should not be explicitly specialized, and vice versa.
-- http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/cludwig.html LiDIA: http://www.informatik.tu-darmstadt.de/TI/LiDIA/Welcome.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk