A
ALiX
I'm writing a class where one template parameter must be a type
behaving like a floating-point type. Is there a standard way of
checking for this?
I can come up with two ways of doing this. One is to check if
std::numeric_limits<T>::is_specialized == true and
std::numeric_limits<T>::is_integer == false. Do other libraries use
this test? Is this in any way standard practice?
A second alternative I can think of is to write a FloatingPointConcept
class and use Boost's concept_check library. But I'm not sure as to
what syntactic constructions I should test for (seems to be many of
them!). Also, even if a type conforms to the syntatic constructions I
test for, the type might not behave like a floating point type
semantically.
Cheers,
/ALiX
behaving like a floating-point type. Is there a standard way of
checking for this?
I can come up with two ways of doing this. One is to check if
std::numeric_limits<T>::is_specialized == true and
std::numeric_limits<T>::is_integer == false. Do other libraries use
this test? Is this in any way standard practice?
A second alternative I can think of is to write a FloatingPointConcept
class and use Boost's concept_check library. But I'm not sure as to
what syntactic constructions I should test for (seems to be many of
them!). Also, even if a type conforms to the syntatic constructions I
test for, the type might not behave like a floating point type
semantically.
Cheers,
/ALiX