[Dune] Precompiling some methods of template classes...

Thimo Neubauer thimo.neubauer at iwr.uni-heidelberg.de
Fri Jun 17 15:08:59 CEST 2005


Hi,

On Thu, Jun 16, 2005 at 09:36:00PM +0200, Thimo Neubauer wrote:
> ... doesn't work anymore with G++ 4.0 :-( [...]

Oh yes it does! :-) Christian had the winning idea, the stuff just
needs to be changed a bit. This fails:

  template class Foo<2>;

  template <int N>
  extern void Foo<N>::bar()
  {
        std::cout << "bar " << N << std::endl;
  }

but this works with 4.0:

  template <int N>
  extern void Foo<N>::bar()
  {
        std::cout << "bar " << N << std::endl;
  }

  template class Foo<2>;

I guess because then bar is obviously used and won't get kicked out.

Cheers
   Thimo




More information about the Dune mailing list