-
March 30th, 2012, 03:52 AM
#1
Template syntax puzzle
Has anyone got an idea what the correct syntax for this overloaded operator might be?
This is what I thought would be OK, but it doesn't compile.
Code:
template <typename T>
class MyTemplate
{
public:
template <typename TIterator>
void operator ()(TIterator first, const TIterator& last);
};
template <typename T, typename TIterator>
inline void MyTemplate<T>::operator ()(TIterator first,
const TIterator& last)
{
}
Combining the declaration and definition in the class compiles fine, but there are compiler specific reasons why they must be separate. (It's to do with memory section directives)
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
-
March 30th, 2012, 03:59 AM
#2
Re: Template syntax puzzle
Wouldn't it be:
Code:
template <typename T>
template <typename TIterator>
inline void MyTemplate<T>::operator ()(TIterator first,
const TIterator& last)
{
}
-
March 30th, 2012, 04:11 AM
#3
Re: Template syntax puzzle
Yes, that works
Seems perfectly logical now.
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|