Commit 755e378f authored by Davis King's avatar Davis King

Changed the is_signed_type and is_unsigned_type templates to work

with floating point types in addition to integer types.
parent f7d6ab88
......@@ -512,7 +512,7 @@ namespace dlib
/*!A is_unsigned_type
This is a template where is_unsigned_type<T>::value == true when T is an unsigned
integral type and false when T is a signed integral type.
scalar type and false when T is a signed scalar type.
!*/
template <
typename T
......@@ -521,13 +521,16 @@ namespace dlib
{
static const bool value = static_cast<T>((static_cast<T>(0)-static_cast<T>(1))) > 0;
};
template <> struct is_unsigned_type<long double> { static const bool value = false; };
template <> struct is_unsigned_type<double> { static const bool value = false; };
template <> struct is_unsigned_type<float> { static const bool value = false; };
// ----------------------------------------------------------------------------------------
/*!A is_signed_type
This is a template where is_signed_type<T>::value == true when T is a signed
integral type and false when T is an unsigned integral type.
scalar type and false when T is an unsigned scalar type.
!*/
template <
typename T
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment