mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-10 23:44:29 +00:00
refactoring
This commit is contained in:
parent
9dc22008a7
commit
eef1ac9339
1 changed files with 2 additions and 4 deletions
|
|
@ -326,9 +326,8 @@ namespace ops {
|
|||
template <typename E, typename D = std::decay_t<E>, typename = detail::enable_if_enum_t<E>>
|
||||
std::ostream& operator<<(std::ostream& os, E value) {
|
||||
static_assert(std::is_enum_v<D>, "magic_enum::ops::operator<< requires enum type.");
|
||||
const auto name = detail::name_impl<D>(static_cast<int>(value));
|
||||
|
||||
if (!name.empty()) {
|
||||
if (auto name = detail::name_impl<D>(static_cast<int>(value)); !name.empty()) {
|
||||
os << name;
|
||||
}
|
||||
|
||||
|
|
@ -340,8 +339,7 @@ std::ostream& operator<<(std::ostream& os, std::optional<E> value) {
|
|||
static_assert(std::is_enum_v<E>, "magic_enum::ops::operator<< requires enum type.");
|
||||
|
||||
if (value.has_value()) {
|
||||
const auto name = detail::name_impl<E>(static_cast<int>(value.value()));
|
||||
if (!name.empty()) {
|
||||
if (auto name = detail::name_impl<E>(static_cast<int>(value.value())); !name.empty()) {
|
||||
os << name;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue