Split thread and range stuff out of utils

This commit is contained in:
Vinnie Falco
2013-05-27 10:05:49 -07:00
parent 9b5d047c90
commit 90bc0c1a8c
16 changed files with 271 additions and 128 deletions

View File

@@ -68,6 +68,39 @@ namespace boost
};
}
// VFALCO: Maybe not the best place for this but it sort of makes sense here
// VFALCO: NOTE, these three are unused.
/*
template<typename T> T range_check(const T& value, const T& minimum, const T& maximum)
{
if ((value < minimum) || (value > maximum))
throw std::runtime_error("Value out of range");
return value;
}
template<typename T> T range_check_min(const T& value, const T& minimum)
{
if (value < minimum)
throw std::runtime_error("Value out of range");
return value;
}
template<typename T> T range_check_max(const T& value, const T& maximum)
{
if (value > maximum)
throw std::runtime_error("Value out of range");
return value;
}
*/
template<typename T, typename U> T range_check_cast(const U& value, const T& minimum, const T& maximum)
{
if ((value < minimum) || (value > maximum))
throw std::runtime_error("Value out of range");
return static_cast<T>(value);
}
#endif
// vim:ts=4