cxxomfort
rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Supplements to the standard utilities in <numeric>
.
More...
Namespaces | |
ctmath | |
Compile-time arithmethic functions, that can be used in template parameters. | |
Functions | |
template<typename T > | |
std::make_signed< T >::type | to_signed (T t) |
Converts t to the equivalent integral signed type. More... | |
template<typename T > | |
std::make_unsigned< T >::type | to_signed (T t) |
Converts t to the equivalent integral unsigned type. More... | |
template<typename It , typename T , typename F > | |
T | accumulate_right (It ini, It fin, T v0, F f) |
Folds a sequence with f from the right . More... | |
Supplements to the standard utilities in <numeric>
.
std::make_signed<T>::type cxxomfort::library::numeric::to_signed | ( | T | t | ) |
Converts t to the equivalent integral signed
type.
Converts t to the equivalent integral signed
type.
t | A value fo one of C++'s integer types. |
signed
(eg.: "signed int"). std::make_unsigned<T>::type cxxomfort::library::numeric::to_signed | ( | T | t | ) |
Converts t to the equivalent integral unsigned
type.
Converts t to the equivalent integral unsigned
type.
Converts t to the equivalent integral signed
type.
t | A value fo one of C++'s integer types. |
signed
(eg.: "signed int"). T cxxomfort::library::numeric::accumulate_right | ( | It | ini, |
It | fin, | ||
T | v0, | ||
F | f | ||
) |
Folds a sequence with f from the right .
f | An accumulator object. |
v0 | An initial value. |
This function is exactly like std::accumulate
except that the accumulator processes its state value on the right instead of on the left. In other words, if v
carries the state, where std::accumulate
calculates f(v, x_i)
, accumulate_right
calculates f(x_i, v)
.