Skip to content

Commit 6c605ef

Browse files
committed
Add missing overload for is function to handle enums
1 parent fd0c99d commit 6c605ef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/cpp2util.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,11 @@ auto is( X const& x ) -> bool {
548548
return x == X();
549549
}
550550

551+
template< auto value, typename X >
552+
requires std::is_enum_v<decltype(value)> && std::is_same_v<decltype(value),X>
553+
auto is( X const& x ) -> bool {
554+
return x == value;
555+
}
551556

552557
//-------------------------------------------------------------------------------------------------------------
553558
// Built-in as (partial)

0 commit comments

Comments
 (0)