specialized constructor in specialized class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear list,

I try to specialize a copy constructor in a specialized class. I keep getting:

"explicit specialization in non-namespace scope class RComplex<double>"

from the compiler. I use GNU g++
gcc version 4.3.4

How can the specialized constructor be defined?

Frank





template<class T> class RComplex
{
public:
  RComplex() {}
  ~RComplex() {}
private:
  T re;
  T im;
};


template<>
class RComplex<double>
{
public:
  RComplex() {}
  ~RComplex() {}

  template<class T>
  RComplex(T arg)
  {
  }

  template<>
  RComplex(int arg)
  {
  }

private:
  double F[2];
};


int main()
{
  int i=1;
  RComplex<double> z(i);

  return 0;
}



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux