[Bf-committers] problems with C++

Jonathan Merritt j.merritt at pgrad.unimelb.edu.au
Tue Oct 4 05:47:22 CEST 2005


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 138 bytes
Desc: not available
Url : http://projects.blender.org/pipermail/bf-committers/attachments/20051004/83374484/main.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sptemp.h
Type: text/x-chdr
Size: 92 bytes
Desc: not available
Url : http://projects.blender.org/pipermail/bf-committers/attachments/20051004/83374484/sptemp.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sptemp1.cpp
Type: text/x-c++src
Size: 162 bytes
Desc: not available
Url : http://projects.blender.org/pipermail/bf-committers/attachments/20051004/83374484/sptemp1.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sptemp2.cpp
Type: text/x-c++src
Size: 241 bytes
Desc: not available
Url : http://projects.blender.org/pipermail/bf-committers/attachments/20051004/83374484/sptemp2.cpp


More information about the Bf-committers mailing list