Boost logo

Boost Users :

Subject: [Boost-users] Function template specialization
From: Surya Kiran Gullapalli (suryakiran.gullapalli_at_[hidden])
Date: 2009-12-18 05:11:11


Hello all,
The following question may not be related to boost, but if a solution can be
found with boost or otherwise would be great.

I've a base class with a function template.

I derive from base class and try to have a specialization for the function
template in derived class

I did something like this.

////////////////////////// Header file begin //////////////////////////
class Base
{
..
template <typename T>
fun (T arg) { ... }

};

class Derived : public Base
{
...
} ;

template <>
Derived::fun(int arg);

///////////////////////// Header file end ////////////////////////////

and in .cpp file I've provided implementation for the template
specialization.

This works fine with MSVC 8.0 and g++ complains about lack of function
declaration fun in Derived class.

I do not know which compiler is behaving correctly. Any help in this is
greatly appreciated.

Thanks in advance,
Surya



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net