iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Conversion functions between types

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.


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.