|
template<class T > |
constexpr const T & | clamp (const T &v, const T &lo, const T &hi) |
| Bound a value to a lower and upper limit if exceeded. More...
|
|
template<class T > |
constexpr const bool | is_in_bounds (const T &v, const T &lo, const T &hi) |
| Check if a value is inside the interval [lo, hi]. More...
|
|
template<class T , class Iterator > |
const bool | is_in_bounds_all (Iterator first, Iterator last, const T &lo, const T &hi) |
| Check if all components of a container are inside the interval [lo, hi]. More...
|
|
double | l2_norm_2d (double a, double b) |
| Compute the l2 norm of a 2d vector [a,b] as sqrt(a*a+b*b) More...
|
|
template<typename T , typename... Args> |
std::unique_ptr< T > | make_unique (Args &&... args) |
| Constructs an object of type T and wraps it in a std::unique_ptr. More...
|
|
double | max_approx_continuous (double x, double y, double eps) |
| Continuous approximation of the max-operator. More...
|
|
template<class T > |
int | sign (T val) |
| Signum function. More...
|
|
template<class ValT , class SignT > |
ValT | sign (ValT a, SignT b) |
| Return value a with sign of value b. More...
|
|
template<typename T , typename... Args>
std::unique_ptr<T> corbo::util::make_unique |
( |
Args &&... |
args | ) |
|
|
inline |
Constructs an object of type T and wraps it in a std::unique_ptr.
Until C++14 is not widespread, we define our own make_unique.
- Parameters
-
args | Arbitrary argument list that is compatible with the constructor list required by type T |
- Returns
- std::unique_ptr of type
T
constructed with args
Definition at line 135 of file core/include/corbo-core/utilities.h.
template<class ValT , class SignT >
ValT corbo::util::sign |
( |
ValT |
a, |
|
|
SignT |
b |
|
) |
| |
|
inline |
Return value a with sign of value b.
If b > 0 then the result is |a|, else it is -|a|.
- Parameters
-
[in] | a | value which is subject to sign of b |
[in] | b | value from which the sign is extracted |
- Template Parameters
-
ValT | Type of a |
SignT | Type of b (must support SignT(0)) |
- Returns
- |a| with sign of b and type ValT.
Definition at line 116 of file core/include/corbo-core/utilities.h.