mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-10 23:44:29 +00:00
clean-up ostream operator
This commit is contained in:
parent
f5ef718120
commit
777792339c
2 changed files with 9 additions and 11 deletions
|
|
@ -394,13 +394,7 @@ std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& o
|
|||
static_assert(detail::check_enum_v<E, D>, "magic_enum::ostream_operators::operator<< requires enum type.");
|
||||
|
||||
if (value.has_value()) {
|
||||
if (auto name = detail::name_impl<D>(value.value()); !name.empty()) {
|
||||
for (auto c : name) {
|
||||
os.put(c);
|
||||
}
|
||||
} else {
|
||||
os << static_cast<std::underlying_type_t<D>>(value.value());
|
||||
}
|
||||
os << value.value();
|
||||
}
|
||||
|
||||
return os;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue