[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SPAM] [Openexr-user] Hi everybody
From: |
Kevin Wheatley |
Subject: |
Re: [SPAM] [Openexr-user] Hi everybody |
Date: |
Tue, 10 Oct 2006 11:21:55 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) |
Dharmendra Bhojwani wrote:
I have a function declaration like this in a template class.
template <class T> class CElement
{
public:
template <class Y> bool _internal_less (CElement<Y> const& rhs) const;
};
And following is the function defination...
template <class T, class Y> inline
bool CElement <T>::_internal_less (CElement<Y> const& rhs) const
{
return iCount < rhs.iCount;
}
when i compile it using , g++ , it gives error ....
"prototype for `bool CElement<T>::_internal_less(const CElement<Y>&)
const' does not match any in class `CElement<T>'"
couple of suggestions...
you can't define an inline function out of line ... also you need two
separate template<> parameter definitions in your out of line
definition, one for the class template and one for the template member
function. With such a simple function I'd use an inline definition
especially if you have profiling data to backup your need for inlining
the function:
template <class T> class CElement
{
public:
template <class Y>
bool _internal_less (CElement<Y> const& rhs) const
{
return iCount < rhs.iCount;
}
};
If you want an out of line definition then something like this should
work:
template <class T>
template <class Y>
bool CElement <T>::_internal_less (CElement<Y> const& rhs) const
{
return iCount < rhs.iCount;
}
Kevin
--
| Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this |
| Senior Technology | My employer for certain |
| And Network Systems Architect | Not even myself |