|
Boost : |
From: Michael Stevens (support-1_at_[hidden])
Date: 2002-08-25 21:52:16
>
>
>Date: Thu, 22 Aug 2002 23:10:56 -0500
>From: Rene Rivera <grafik666_at_[hidden]>
>To: boost_at_[hidden]
>Subject: Re: [boost] Compiler deficiency for Quaternion library
>
>[2002-08-23] Michael Stevens wrote:
>
>
>>// explict.hpp Class with explict specialization
>>template <class T>
>>struct TC {
>>};
>>
>>template <>
>>struct TC<int> {
>> void f2(); // Decleration of class template
>>specialisation member function
>>};
>>
>>void TC<int>::f2() // Definintion of class template specialisation
>>member function
>>{}
>>
>>
>
>Shouldn't that be:
>
>template <> void TC<int>::f2() { }
>
>
Nope. The definition syntax is correct. See 14.7.3 Paragraph 5,
explicit specialization syntax not used for a member of explicitly
specialized class template specialization.
>???
>
>Have you considered/tried moving the:
>
>template <> struct TC<int> ...
>
>To the definition file? With the caveat that you would have to place
>declarations for the methods in the "template <class T> struct TC { };"
>
>You are talking about 2 files here, right?
>
>
>
Definately two files (two compilation units). e.g. for GCC
files1.cpp:
#include <explict.hpp>
files2.cpp
#include <explict.hpp>
gcc files1.cpp files2.cpp
->> errors!
The problem is that all other template Definitions can be placed in
header files. This is why most of Boost and in particularly Quaternion
just exist as a bunch of headers.
The compiler deficiency is that these specific definitions are not
treated and template definitions by both GCC and VC. I would be very
interested if anyone can tell me how other compilers implement this.
The definciency is annoying. It means that to implement some
specialisations with these compilers we need to add implementation
files. This add to the whole problem of building boost.
Michael
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk