Can alias templates (14.5.7) be explicitly specialised (14.7.3)?
My standard-fu fails me, and I can\'t find a compiler to test on.
The text \"when a template
If you need pointwise mapping from something to types, this works(in gcc 4.8.3):
// int to type mapper
template
struct BitsToTypesMap
{
typedef void TYPE; // default
};
// pointwise mapping
template<>
struct BitsToTypesMap<32>{ typedef int TYPE; };
template<>
struct BitsToTypesMap<8>{ typedef char TYPE; };
template<>
struct BitsToTypesMap<16>{ typedef short TYPE; };
// cute wrapping
template using MyScalarType = typename BitsToTypesMap::TYPE;
// TEST
template
MyScalarType
Add ( MyScalarType x, MyScalarType y )
{
return x+y;
}
int
test()
{
MyScalarType<32> i=Add<32>(1,2);
MyScalarType<8 > b=Add<8 >(1,2);
MyScalarType<16> s=Add<16>(1,2);
return i+b+s;
}