|
KaMPIng 0.2.0
Flexible and (near) zero-overhead C++ bindings for MPI
|
Helper functions that make casts safer. More...
#include <cstdint>#include <limits>#include <stdexcept>#include <string>#include <type_traits>#include "kamping/kassert/kassert.hpp"#include "kamping/noexcept.hpp"

Go to the source code of this file.
Functions | |
| template<class To , class From > | |
| constexpr bool | kamping::in_range (From value) noexcept |
| Checks if an integer value can be safely casted into an integer type To, that is, it lies in the range [min(To), max(To)]. | |
| template<class To , class From > | |
| constexpr To | kamping::asserting_cast (From value) KAMPING_NOEXCEPT |
| Casts an integer value to the integer type To. If the value is outside To's range, throws an assertion. | |
| template<class To , class From > | |
| constexpr To | kamping::throwing_cast (From value) |
| Casts an integer value to the integer type To. If the value is outside To's range, throws an exception. | |
Helper functions that make casts safer.