Exiv2
Classes | Namespaces | Functions
safe_op.hpp File Reference

Overflow checks for integers. More...

#include <limits>
#include <stdexcept>
+ Include dependency graph for safe_op.hpp:

Classes

struct  Safe::Internal::is_signed< T >
 Helper struct to determine whether a type is signed or unsigned. More...
 
struct  Safe::Internal::enable_if< B, T >
 Helper struct for SFINAE, from C++11. More...
 
struct  Safe::Internal::enable_if< true, T >
 Specialization of enable_if for the case B == true. More...
 
struct  Safe::Internal::fallback_add_overflow< T, typename >
 Fallback overflow checker, specialized via SFINAE. More...
 
struct  Safe::Internal::fallback_add_overflow< T, typename enable_if< is_signed< T >::VALUE >::type >
 Overload of fallback_add_overflow for signed integers. More...
 
struct  Safe::Internal::fallback_add_overflow< T, typename enable_if<!is_signed< T >::VALUE >::type >
 Overload of fallback_add_overflow for unsigned integers. More...
 
struct  Safe::Internal::builtin_add_overflow< T >
 Overflow checker using compiler intrinsics. More...
 

Namespaces

 Safe
 Arithmetic operations with overflow checks.
 
 Safe::Internal
 Helper structs for providing integer overflow checks.
 

Functions

template<typename T >
Safe::add (T summand_1, T summand_2)
 Safe addition, throws an exception on overflow. More...
 

Detailed Description

Overflow checks for integers.

Author
Dan Čermák (D4N) dan.cermak@cgc-instruments.com
Date
14-Dec-17, D4N: created