sanisizer
Sanitize sizes to avoid integer overflow
Loading...
Searching...
No Matches
cast.hpp
Go to the documentation of this file.
1#ifndef SANISIZER_CAST_HPP
2#define SANISIZER_CAST_HPP
3
4#include "attest.hpp"
5
11namespace sanisizer {
12
26template<typename Size_, typename Value_>
27constexpr auto can_cast(Value_ x) {
29 return get_value(x);
30}
31
45template<typename Dest_, typename Value_>
46constexpr Dest_ cast(Value_ x) {
47 return can_cast<Dest_>(x);
48}
49
50}
51
52#endif
Create compile-time attestations.
Sanitize sizes to avoid integer overflow.
Definition arithmetic.hpp:16
constexpr auto get_value(Value_ x)
Definition attest.hpp:105
constexpr auto can_cast(Value_ x)
Definition cast.hpp:27
constexpr bool check_overflow(Value_ x)
Definition attest.hpp:178
constexpr Dest_ cast(Value_ x)
Definition cast.hpp:46