mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 06:55:50 +00:00
Split thread and range stuff out of utils
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user