olp-cpp-sdk  1.22.0
Public Types | List of all members
olp::math::OverflowTrait< T, IntegerBits, IsSigned > Struct Template Reference

Maps an integer type to the one that can handle arithmetic overflows. More...

#include <AlignedBox.h>

Public Types

using Type = T
 An alias for the integer type.
 

Detailed Description

template<typename T, int IntegerBits = std::is_integral<T>::value ? sizeof(T) * 8 : 0, bool IsSigned = std::numeric_limits<T>::is_signed>
struct olp::math::OverflowTrait< T, IntegerBits, IsSigned >

Maps an integer type to the one that can handle arithmetic overflows.

For integer types less than 64 bits, it maps to a larger type that can handle overflows. The default implementation handles types, including the floating-point ones. Specifications are used to handle integer types.

Note
For float, it can overflow as well. However, the overflow case is relatively rare compared to the integer types. Also if T itself is a 64-bit integer type, it can overflow as well.

The documentation for this struct was generated from the following file: