 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Daveed Vandevoorde Guest
|
Posted: Tue Jul 22, 2003 10:56 pm Post subject: Re: Multiple explicit instantiations? |
|
|
[email]dsp (AT) bdal (DOT) de[/email] (Daniel Spangenberg) wrote:> Our Holy Standard claims in 14.7.2/4:
| Quote: |
"The definition of a non-exported function template, a non-exported
member
function template, or a non-exported member function or static data
member
of a class template shall be present in every translation unit in which
it is
explicitly instantiated."
I am wondering concerning this description,because it seems to imply,
that more than one explicit instantiation for the same class (function, ...)
in> the program are OK.
[...] |
Not really. It just takes into account the fact that a same _template_
(or member thereof) can be instantiated in multiple translation units.
For example:
// TU1:
template<typename T> void f() {}
template void f<void>;
// TU2:
template<typename T> void f() {}
template void f<int*>;
These are fine. But the following:
// TU3:
template<typename T> void f();
template void f<bool>; // Error: missing definition of f.
is not.
Daveed
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|