I've a simple primary function template that I want to partially specialize.
template< typename T >
void SetAttribute( const T& value )
{
static_assert( false, "SetAttribute: wrong type!" );
}
template<> void SetAttribute( const bool& value ) {}
template<> void SetAttribute( const std::wstring& value ) {}
template< typename T >
void SetAttribute( const typename std::enable_if< std::is_integral< T >::value >::type& value ) {}
int main()
{
SetAttribute( std::wstring( L"bla" ) );
SetAttribute( bool( true ) );
SetAttribute( std::uint32_t( 1 ) ); // error C2338: SetAttribute: wrong type!
return 0;
}
When I compile this with VS 2015 Update 3, then I'll get an error on the 3d call (see comment). why? I don't understand why the 3d specialization is not used.
Thx Fred