PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
pbat::math::OverflowChecked< Integer > Struct Template Reference

Wrapper around integer types that throws when integer overflow is detected. More...

#include <IntegerArithmeticChecks.h>

Public Types

using SelfType = OverflowChecked<Integer>
 Instance type.
 

Public Member Functions

Integer & operator* ()
 Dereference operator.
 
Integer const & operator* () const
 Const dereference operator.
 
SelfType operator- () const
 Negation operator.
 
SelfType operator+ (SelfType rhs) const
 Addition operator.
 
SelfType operator* (SelfType rhs) const
 Multiplication operator.
 
SelfType operator- (SelfType rhs) const
 Subtraction operator.
 
SelfType operator/ (SelfType rhs) const
 Division operator.
 
template<std::integral OtherInteger>
SelfType operator/ (OtherInteger rhs) const
 Division operator.
 
 operator Integer () const
 Cast operator to underlying type.
 

Public Attributes

Integer value
 Underlying integer value.
 

Detailed Description

template<std::integral Integer>
struct pbat::math::OverflowChecked< Integer >

Wrapper around integer types that throws when integer overflow is detected.

Template Parameters
IntegerThe type of the integer to wrap

Member Function Documentation

◆ operator*() [1/3]

template<std::integral Integer>
Integer & pbat::math::OverflowChecked< Integer >::operator* ( )
inline

Dereference operator.

Returns
Underlying integer value

◆ operator*() [2/3]

template<std::integral Integer>
Integer const & pbat::math::OverflowChecked< Integer >::operator* ( ) const
inline

Const dereference operator.

Returns
Underlying integer value

◆ operator*() [3/3]

template<std::integral Integer>
SelfType pbat::math::OverflowChecked< Integer >::operator* ( SelfType rhs) const
inline

Multiplication operator.

Parameters
rhsRight-hand side operand
Returns
Product of the two operands

◆ operator+()

template<std::integral Integer>
SelfType pbat::math::OverflowChecked< Integer >::operator+ ( SelfType rhs) const
inline

Addition operator.

Parameters
rhsRight-hand side operand
Returns
Sum of the two operands

◆ operator-() [1/2]

template<std::integral Integer>
SelfType pbat::math::OverflowChecked< Integer >::operator- ( ) const
inline

Negation operator.

Returns
Negated value

◆ operator-() [2/2]

template<std::integral Integer>
SelfType pbat::math::OverflowChecked< Integer >::operator- ( SelfType rhs) const
inline

Subtraction operator.

Parameters
rhsRight-hand side operand
Returns
Difference of the two operands

◆ operator/() [1/2]

template<std::integral Integer>
template<std::integral OtherInteger>
SelfType pbat::math::OverflowChecked< Integer >::operator/ ( OtherInteger rhs) const
inline

Division operator.

Parameters
rhsRight-hand side operand
Returns
Quotient of the two operands

◆ operator/() [2/2]

template<std::integral Integer>
SelfType pbat::math::OverflowChecked< Integer >::operator/ ( SelfType rhs) const
inline

Division operator.

Parameters
rhsRight-hand side operand
Returns
Quotient of the two operands

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