Returns the underlying integer value of an enum.

Synopsis

Declared in <llvm/ADT/STLForwardCompat.h>

template<typename Enum>
[[nodiscard]]
constexpr
std::underlying_type_t<Enum>
to_underlying(Enum E);

Description

Backport of C++23 std::to_underlying.

Return Value

The underlying integer value of E.

Note

The return value should not be discarded.

Parameters

Name

Description

E

Enumeration value to convert.

Created with MrDocs