1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-17 00:44:19 +00:00

update doc

This commit is contained in:
terik23 2019-04-04 11:01:17 +05:00
parent 6e9fdcc6da
commit 48e70234b5
2 changed files with 9 additions and 9 deletions

View file

@ -166,7 +166,7 @@ struct enum_from_string_impl_t<E, MAGIC_ENUM_RANGE> final {
} // namespace detail
// enum_to_string(enum) used to obtain string enum name from enum variable.
// enum_to_string(enum) obtains string enum name from enum variable.
template <typename T, typename = std::enable_if_t<std::is_enum_v<std::decay_t<T>>>>
[[nodiscard]] constexpr std::optional<std::string_view> enum_to_string(T value) noexcept {
constexpr bool s = std::is_signed_v<std::underlying_type_t<std::decay_t<T>>>;
@ -177,13 +177,13 @@ template <typename T, typename = std::enable_if_t<std::is_enum_v<std::decay_t<T>
return detail::enum_to_string_impl_t<std::decay_t<T>, min>{}(static_cast<int>(value));
}
// enum_to_string<enum>() used to obtain string enum name from static storage enum variable
// enum_to_string<enum>() obtains string enum name from static storage enum variable.
template <auto V, typename = std::enable_if_t<std::is_enum_v<std::decay_t<decltype(V)>>>>
[[nodiscard]] constexpr std::optional<std::string_view> enum_to_string() noexcept {
return detail::enum_to_string_impl<decltype(V), V>();
}
// enum_from_string(name) used to obtain enum variable from enum string name.
// enum_from_string(name) obtains enum variable from enum string name.
template <typename E, typename = std::enable_if_t<std::is_enum_v<E>>>
[[nodiscard]] constexpr std::optional<E> enum_from_string(std::string_view name) noexcept {
constexpr bool s = std::is_signed_v<std::underlying_type_t<E>>;