Hi everybody outthere,
While trying to compile the following code under SunStudio 11:
template<typename T, typename U=T>
struct UnaryFunc : std::unary_function<T,U>{
virtual U operator() (T _X) const = 0;
virtual ~UnaryFunc() {};
};
template<typename T, typename U=T>
struct UnaryFuncWithDerivative : UnaryFunc<T,U>
{
virtual UnaryFunc<T,U>* Derivative() const = 0;
virtual ~UnaryFuncWithDerivative() {}
};
template<typename T, typename U=T>
struct UnaryFuncWithNumDerivative : UnaryFuncWithDerivative<T,U>
{
UnaryFuncWithNumDerivative(const UnaryFunc<T,U>& f, double eps=0.000001)
: UnaryFuncWithDerivative<T,U>(), itsFunction(f), itsDerivative(new NumderivativeFunc<T,U>(f, eps))
{}
// destructor
virtual U operator() (T _X) const // *Line 72*
{ return itsFunction(_X); }
private:
// copy constructor
// operator =
private:
const UnaryFunc<T,U>& itsFunction;
UnaryFunc<T,U>* itsDerivative;
}
// Somewhere in another file which I will call ErrorFile
...
UnaryFuncWithNumDerivative<double> funcWithDeriv(func); // *Line 79*
...
I am getting the following error (_when compiling ErrorFile_):
line 72: Error: ")" expected instead of "0x00000080"
ErrorFille
line 79: Where: While specializing "UnaryFunc<double, double>".
ErrorFile
line 79: Where: Specialized in non-template code.
Can anyone solve this issue ?
thx,
Edited by: Mhidi on Apr 27, 2010 8:52 AM