R
Rene Ivon Shamberger
In a class I declared a template function
---myClass.hpp---
#ifndef MYCLASS_HPP
#define MYCLASS_HPP
namespace ABC{
class myClass{
....
public:
myClass();
~myClass();
void someMethod();
template< typename T> std::string& myTemplate(const T& data);
}; // class
} // namespace
#include "myClass.tcc"
#endif
---myClass.cpp---
ABC::myClass::myClass(){/*nothing*/}
ABC::myClass::~myClass(){/*nothing*/}
ABC::myClass::someMethod(){/*nothing*/}
In a tcc file I impletemtn the template function
---myClass.tcc--
template< typename T>
std::string& ABC::myClass::myTemplate(const T& data){
...
return someString;
}
VC++ gives me an error that reads:
error C2039: 'myTemplate' : is not a member of 'ABC'
I tried this:
namespace ABC{
template< typename T>
std::string& ABC::myClass::myTemplate(const T& data){
...
return someString;
}
}
but to no avail.
What am I am doing wrong?
---myClass.hpp---
#ifndef MYCLASS_HPP
#define MYCLASS_HPP
namespace ABC{
class myClass{
....
public:
myClass();
~myClass();
void someMethod();
template< typename T> std::string& myTemplate(const T& data);
}; // class
} // namespace
#include "myClass.tcc"
#endif
---myClass.cpp---
ABC::myClass::myClass(){/*nothing*/}
ABC::myClass::~myClass(){/*nothing*/}
ABC::myClass::someMethod(){/*nothing*/}
In a tcc file I impletemtn the template function
---myClass.tcc--
template< typename T>
std::string& ABC::myClass::myTemplate(const T& data){
...
return someString;
}
VC++ gives me an error that reads:
error C2039: 'myTemplate' : is not a member of 'ABC'
I tried this:
namespace ABC{
template< typename T>
std::string& ABC::myClass::myTemplate(const T& data){
...
return someString;
}
}
but to no avail.
What am I am doing wrong?