Skip to content

Commit

Permalink
Update enum_name.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
mguludag authored Mar 13, 2024
1 parent fdd3ac8 commit 1f524e1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/enum_name.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <array>
#include <cstdint>
#include <cstring>
#include <ostream>
#include <string>
#include <type_traits>
#include <utility>
Expand Down Expand Up @@ -586,4 +587,12 @@ namespace mgutility {
}
} // namespace mgutility

template<typename Enum, typename std::enable_if<std::is_enum<Enum>::value, bool>::type = true>
auto operator<<(std::ostream& os, Enum e) -> std::ostream&
{
static_assert(std::is_enum<Enum>::value, "Value is not an Enum type!");
os << mgutility::enum_name(e);
return os;
}

#endif // MGUTILITY_ENUM_NAME_HPP

0 comments on commit 1f524e1

Please sign in to comment.