P
petschy
hello all,
i'm trying to write a trait class (to generate an uint hash code for a
type):
template<typename T>
struct S
{
static unsigned int f(const T& t_);
};
template<typename T>
inline unsigned int S<T>::f(const T& t_)
{
// generic version using the bytes of T
}
the specializations for int, std::string work fine:
template<>
inline unsigned int S<unsigned int>::f(const unsigned int& s_);
template<>
inline unsigned int S<std::string>::f(const std::string& s_);
for void*, i get an error from gcc 4.1
template<>
inline unsigned int S<void*>::f(const void*& s_);
error: template-id 'f<>' for 'unsigned int S<void*>::f(const
void*&)' does not match any template declaration
i suspect the type of the f() arg is wrong, const void*& means const
reference to void* or reference to const void* ?
cheers, p
i'm trying to write a trait class (to generate an uint hash code for a
type):
template<typename T>
struct S
{
static unsigned int f(const T& t_);
};
template<typename T>
inline unsigned int S<T>::f(const T& t_)
{
// generic version using the bytes of T
}
the specializations for int, std::string work fine:
template<>
inline unsigned int S<unsigned int>::f(const unsigned int& s_);
template<>
inline unsigned int S<std::string>::f(const std::string& s_);
for void*, i get an error from gcc 4.1
template<>
inline unsigned int S<void*>::f(const void*& s_);
error: template-id 'f<>' for 'unsigned int S<void*>::f(const
void*&)' does not match any template declaration
i suspect the type of the f() arg is wrong, const void*& means const
reference to void* or reference to const void* ?
cheers, p