Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::shortest_path_detail Namespace Reference

Namespace for shortest path algorithm implementation details. More...

Functions

template<typename T >
T checked_add (const T &a, const T &b)
 Safely add two distance values with overflow checking.
 

Detailed Description

Namespace for shortest path algorithm implementation details.

Function Documentation

◆ checked_add()

template<typename T >
T Aleph::shortest_path_detail::checked_add ( const T a,
const T b 
)
inline

Safely add two distance values with overflow checking.

For integral types, checks for overflow/underflow before performing the addition. For floating-point types, performs regular addition.

Template Parameters
TDistance type (integral or floating-point).
Parameters
aFirst operand.
bSecond operand.
Returns
Sum of a and b.
Exceptions
std::overflow_errorIf integer overflow/underflow would occur.

Definition at line 120 of file shortest_path_common.H.

References ah_overflow_error_if, and Aleph::maps().

Referenced by Aleph::Johnson< GT, Distance, Ait, NAit, SA >::checked_add(), and Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::checked_add().