On Wed, 04 Feb 2004 16:12:38 GMT, Fred H <secret@nospam.com> wrote:
[color=blue]
>[color=green]
>> The problems you're facing are due to the shortcoming of the VC++ 6.0
>> compiler regarding templates.[/color]
>
>I'm starting to realise this...
>[color=green]
>> However, it can easily be solved by moving
>> the template declaration from the function to the class ...[/color]
>
>Ok? It's just that I'm not using templates for the class. Only
>for the function. (But I've started putting the template def
>in the header file, and not using explicit specification, and
>now it works. But...see next paragraph.)
>[color=green]
>> Furthermore it is good practice to implement templates in the context of
>> the header file and not the .cpp ...[/color]
>
>But the FAQ suggests that this can cause "significant code bloat".
>How about that?[/color]
This bloat occurs on compiler/linker combinations that aren't able to
coalesce instantiations of template specializations from different
translation units into a single definition of the specialization in
the final executable. The only system that I have used that has this
problem is GCC on qnx-nto. I doubt you're using anything so obscure!
MSVC, Borland, GCC on normal platforms, Intel, Metrowerks, etc., etc.
don't have this problem - they combine instantiations.
Tom
C++ FAQ:
http://www.parashift.com/c++-faq-lite/
C FAQ:
http://www.eskimo.com/~scs/C-faq/top.html