I have this :
template<class T, class U>
class A
{
template<size_t N>
void BindValues();
}
template<class T, class U>
template<size_t N>
inline void A<T, U>::BindValues()
{
conn->setValue<N-1>( std::get<N-1>(m_Tuple) );
BindValues<N-1>(conn);
}
template<class T, class U>
template<>
inline void A<T, U>::BindValues<1>()
{
conn->setValue<0>( std::get<0>(m_Tuple) );
}
My Compile error is:
invalid explicit specialization before '>' token
enclosing class templates are not explicitly specialized
template-id BindValues<1> for void A<T, U>::BindValues() does not match any template declaration
Unfortunately a
templatemethod inside atemplateclass cannot be specialized just based ontemplateargument of method.You need to specialize the
template classalso. In other words, the member method specialization should be a complete specialization with respect toclass template(i.e.<T,U>) params as well as the membertemplateparams (i.e.<size_t>).For example, you may have to specialize something like this (demo):