template< typename int_type >
bool foo( int_type argument )
{
float_type value = argument; // float_type must faithfully represent argument.
...
}
That is, I'd like to derive within the template function the shortest floating point type float_type that has at least as many significant digits as the template parameter int_type.
foo<int16> should use float.
foo<int32> should use double.
foo<int64> should use long double.
Is this doable without specialization?
Aucun commentaire:
Enregistrer un commentaire