Template specialisations
Hello All!
I got stuck with template specialisation, and all my books are at work, so I ask my question here.
Does somebody know how to create a template specialisation for template class template function?
For simple function it would look like this:
template< typename T >
void foo( T param ) { /* body goes here */ }
template<>
void foo( int param ) { /* body goes here */}
But when I try to do something like this:
namespace foo {
template< typename T >
class bar {
template< typename TT >
bar( const bar< TT > &r ) { }
template<>
bar( const bar< T >&r ) { }
};
}
I get an error from gcc (2.96) : explicit specialization in non-namespace scope `class
foo::bar.
How to do the specialisation here?
Thank you in advance.
I got stuck with template specialisation, and all my books are at work, so I ask my question here.
Does somebody know how to create a template specialisation for template class template function?
For simple function it would look like this:
template< typename T >
void foo( T param ) { /* body goes here */ }
template<>
void foo( int param ) { /* body goes here */}
But when I try to do something like this:
namespace foo {
template< typename T >
class bar {
template< typename TT >
bar( const bar< TT > &r ) { }
template<>
bar( const bar< T >&r ) { }
};
}
I get an error from gcc (2.96) : explicit specialization in non-namespace scope `class
foo::bar
How to do the specialisation here?
Thank you in advance.
