C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Multiple explicit instantiations?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Daveed Vandevoorde
Guest





PostPosted: Tue Jul 22, 2003 10:56 pm    Post subject: Re: Multiple explicit instantiations? Reply with quote



[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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.