Skip to content

Commit 0e577ab

Browse files
committed
Deduction guide for EnumName wrapper
1 parent a1213bf commit 0e577ab

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/enum19.lib/enum19/Enum.ostream.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ namespace enum19 {
99
/// This wrapper enables ADL for ostream operator
1010
template<class T> requires(std::is_enum_v<T>) struct EnumName { T v; };
1111

12+
template<class T> EnumName(T) -> EnumName<T>;
13+
1214
template<class T> auto operator<<(std::ostream& out, EnumName<T> wrapper) -> std::ostream& {
1315
auto underlying = static_cast<std::underlying_type_t<T>>(wrapper.v);
1416
return out << valueName(wrapper.v) << " (" << underlying << ")";

0 commit comments

Comments
 (0)