by Tim Frink <plfriko@[EMAIL PROTECTED]
>
May 7, 2008 at 09:51 PM
Hi,
> One other possibility (of limited scope) is to explicitly instantiate
your
> template with the common types you are likely to want and compile that
into
> a lib and only ****p a forward declaration style template definition in
your
> header. That won't work if you are ****pping a template that is supposed
to
> work with a user defined class though.
What you mean is probably the second suggested solution in
http://www.para****ft.com/c++-faq-lite/templates.html#faq-35.15
(add template class Foo<int>; in Foo.cpp), right?
This example is describing a template class, however I'm using
a template function
template< typename T >
void func( bool( T::*f)(void) );
Can this trick with the forward declaration be also applied to template
functions? If so, what do I have to insert in my example file a.cc?
template class A<B>; won't work.
This solution seems to be a sort of a hack because I must know in
advance what template types will be use for 'T'. Can I add different
forward declarations (obviously this must be adjusted to my template
functions) like
template class A<B>;
template class A<C>;
If so it is still better than using the concrete type of class
for "T".