LevelS C++ support library
3.83
|
Go to the source code of this file.
Functions | |
template<typename T1 , typename T2 > | |
T1 | safe_cast (const T2 &arg) |
Numerical cast operator with additional checks that the value is preserved.
Copyright (C) 2009 Max-Planck-Society Author: Martin Reinecke
Definition in file safe_cast.h.
|
inline |
Tries to cast arg from its type to a variable of type T1
. If this conversion leads to a change of the actual value (e.g. due to overflow or truncation), an exception is thrown.
Definition at line 86 of file safe_cast.h.