#include <limits>
#include "error_handling.h"
Go to the source code of this file.
Functions | |
template<typename T1, typename T2> | |
T1 | safe_cast (const T2 &arg) |
Copyright (C) 2009 Max-Planck-Society Author: Martin Reinecke
Definition in file safe_cast.h.
T1 safe_cast | ( | const T2 & | arg | ) | [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.