mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
add compat shim for std::to_underlying
This commit is contained in:
parent
10eddfb177
commit
170ecd7add
17
llarp/util/underlying.hpp
Normal file
17
llarp/util/underlying.hpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
#include <utility>
|
||||
|
||||
namespace llarp
|
||||
{
|
||||
|
||||
#ifdef __cpp_lib_to_underlying
|
||||
using to_underlying = std::to_underlying;
|
||||
#else
|
||||
template <typename T>
|
||||
constexpr auto
|
||||
to_underlying(T t)
|
||||
{
|
||||
return static_cast<std::underlying_type_t<T>>(t);
|
||||
}
|
||||
#endif
|
||||
} // namespace llarp
|
Loading…
Reference in a new issue