fmt::underlying

Converts e to the underlying type.

Synopsis

Declared in <fmt/format.h>

template<typename Enum>
constexpr
underlying_t<Enum>
underlying(Enum e) noexcept;

Description

Example:

enum class color { red, green, blue }; auto s = fmt::format("{}", fmt::underlying(color::red)); // s == "0"