|
Boost : |
From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-01-08 09:07:37
>From: "Thorsten Ottosen" <nesotto_at_[hidden]>
> just want to show you something I discovered
> (maybe you already know) which allows template functions to be specialized
> for a class without including its header; it does require that classes are
> changed internally,
> but I assume it will make compilation mucho faster. (another problem is
that
> I can only
> compile it with Comeau, neither GCC 3.2 or vc7 can eat it).
>
> Anyway, the example is quite straightforward:
>
> #include <iostream>
>
> using namespace std;
>
> template< typename C >
> void foo( const C& c )
> {
> foo_impl( c, C::tag() );
It appears typename is needed here:
foo_impl( c, typename C::tag());
since "tag" is a dependent type. This makes it still work on EDG (I've
tested it on Intel C++), and it works better on GCC 3.2, although now it
reports that it can't disambiguate the two overloaded function templates.
Regards,
Terje
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk