C++ Library Extensions 2022.12.09
To help learn modern C++ programming
007-integer.cpp File Reference
#include <tpf_output.hpp>
#include <tpf_safe_type.hpp>
#include <numeric>
Include dependency graph for 007-integer.cpp:

Go to the source code of this file.

Functions

void display_integral_types ()
 
template<typename Type >
types::enable_if_signed_integral_t< Type > safe_add (Type a, Type b)
 
template<typename Type >
types::enable_if_signed_integral_t< Type > safe_sub (Type a, Type b)
 
template<typename Type >
types::enable_if_unsigned_integral_t< Type > safe_add (Type a, Type b)
 
template<typename Type >
types::enable_if_unsigned_integral_t< Type > safe_sub (Type a, Type b)
 
template<typename Type >
types::enable_if_integral_t< Type > safe_mul (Type a, Type b)
 
template<typename Type >
types::enable_if_integral_t< Type > safe_div (Type a, Type b)
 
void examples_for_safe_arithmetic ()
 
int main ()
 

Variables

tpf::sstream stream
 
auto nl = tpf::nl
 
auto endl = tpf::endl
 

Function Documentation

◆ display_integral_types()

void display_integral_types ( )

Definition at line 12 of file 007-integer.cpp.

Here is the call graph for this function:

◆ examples_for_safe_arithmetic()

void examples_for_safe_arithmetic ( )

Definition at line 214 of file 007-integer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( )

Definition at line 256 of file 007-integer.cpp.

Here is the call graph for this function:

◆ safe_add() [1/2]

template<typename Type >
types::enable_if_signed_integral_t< Type > safe_add ( Type  a,
Type  b 
)

Definition at line 43 of file 007-integer.cpp.

Here is the caller graph for this function:

◆ safe_add() [2/2]

template<typename Type >
types::enable_if_unsigned_integral_t< Type > safe_add ( Type  a,
Type  b 
)

Definition at line 113 of file 007-integer.cpp.

◆ safe_div()

template<typename Type >
types::enable_if_integral_t< Type > safe_div ( Type  a,
Type  b 
)

Definition at line 200 of file 007-integer.cpp.

Here is the caller graph for this function:

◆ safe_mul()

template<typename Type >
types::enable_if_integral_t< Type > safe_mul ( Type  a,
Type  b 
)

Definition at line 166 of file 007-integer.cpp.

Here is the caller graph for this function:

◆ safe_sub() [1/2]

template<typename Type >
types::enable_if_signed_integral_t< Type > safe_sub ( Type  a,
Type  b 
)

Definition at line 104 of file 007-integer.cpp.

Here is the call graph for this function:

◆ safe_sub() [2/2]

template<typename Type >
types::enable_if_unsigned_integral_t< Type > safe_sub ( Type  a,
Type  b 
)

Definition at line 143 of file 007-integer.cpp.

Variable Documentation

◆ endl

auto endl = tpf::endl

Definition at line 7 of file 007-integer.cpp.

◆ nl

auto nl = tpf::nl

Definition at line 6 of file 007-integer.cpp.

◆ stream

tpf::sstream stream

Definition at line 5 of file 007-integer.cpp.