iLab Neuromorphic Robotics Toolkit
0.1
|
Utility functions to allow the safe conversion from any integral or floating point type to another by clamping the value to the destination type's max/min range. The conversion functions also round floating point numbers to the nearest integer (as opposed to the lower one, as by default in C/C++) when converting them to integrals.
Functions | |
template<class dest_type , class source_type > | |
std::enable_if< not_subranged < dest_type, source_type > ::value, dest_type >::type | nrt::clamped_convert (source_type source) |
Perform a clamped-conversion from one type to another. | |