diff --git a/llarp/util/underlying.hpp b/llarp/util/underlying.hpp new file mode 100644 index 000000000..f4cc6ec45 --- /dev/null +++ b/llarp/util/underlying.hpp @@ -0,0 +1,17 @@ +#pragma once +#include + +namespace llarp +{ + +#ifdef __cpp_lib_to_underlying + using to_underlying = std::to_underlying; +#else + template + constexpr auto + to_underlying(T t) + { + return static_cast>(t); + } +#endif +} // namespace llarp