Daily bit(e) of C++ | std::in_range
Daily bit(e) of C++ ♻️5, The C++20 utility for checking whether a value is within the range of integer type: std::in_range.
The std::in_range is a simple C++20 utility that checks whether the given runtime value is within the range of the given integer type.
This can be used to check whether a runtime conversion would be value-changing or, in the case of signed integers, would involve undefined behaviour.