[Bf-committers] problems with C++

Nathan Letwory jesterking at letwory.net
Tue Oct 4 08:11:13 CEST 2005

Hi Jonathan,

With only template class SpTemp<int> it works for msvc too, but adding
template class SpTemp<double> makes it choke on it. (Yes, I added the
extra line also to where the <int> is). Additionally, it is not really
helpful to use such a class if you have to declare *every* templated usage
in the implementation files, thus kinda defeating the purpose of templated


> Hi Nils (and everyone),
> Nils Thuerey wrote:
>>Jonathan - can the explicit instation be used to split up a single
>>templated class? I'll try to ask some of the C++ experts at my instute
>>as well...
> Well, I just discovered that you can in fact split up a templated class
> across multiple *.cpp files with gcc.  I made a tiny test case (files
> attached).  (I'd never tried that before... :-)
> Compile with:
>     g++ main.cpp sptemp1.cpp sptemp2.cpp -o sptemp
> I'm not sure that the technique is standards compliant though (it might
> be; I just don't know).  I think the best idea would be to consult
> someone local who is a C++ guru, or ask the newsgroups.  Even if the
> technique is standards compliant, there's still the question of whether
> it actually works with all of the compilers.
> There may be other, better solutions of course... ?
> Jonathan Merritt.

More information about the Bf-committers mailing list