template explicit specialization

Hello,

I'd be very thankful, if someone could help me with my problem. I have a following class declaration in one of my header files:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class myclass
{

  ...

  private:
    template < typename T > std::string myfunc()
    {
       // here only exception, specialization forward
       assert(false);
    }

  ...

}; //myclass

// explicit specialization

template <> std::string myclass::myfunc < double >()
{
  // here do some stuff
}


This compiles, but the linker displays an error message: "multiple defition, bla-bla". I thought that I could move the specialization to the class scope, but then it doesn't compile, because the specialization should be in a namespace scope.

What am I doing wrong?

Thanks in advance
Have you tried declaring the specialized function inline?
Hey, thanks man! Now it works! Thank you very very much! You saved my poor butt :)
Topic archived. No new replies allowed.