Skip to content

Commit 65027a5

Browse files
author
Tim Crews
committed
Apply patch described in grisumbras#31
1 parent 48d25b4 commit 65027a5

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

include/flags/allow_flags.hpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@
77

88
namespace flags {
99

10-
11-
template <class E, class Enabler = void> struct is_flags
12-
: public std::false_type {};
13-
10+
template <typename T, typename = void>
11+
struct is_flags : std:false_type {};
12+
template <typename T>
13+
struct is_flags < T, decltype(enableEnumFlags(T{})) > : std::true_type {};
1414

1515
} // namespace flags
1616

1717

18-
#define ALLOW_FLAGS_FOR_ENUM(name) \
19-
namespace flags { \
20-
template <> struct is_flags< name > : std::true_type {}; \
21-
}
18+
#define ALLOW_FLAGS_FOR_ENUM(Name) inline void enableEnumFlags(Name) {}
19+
#define ALLOW_FLAGS_FOR_ENUM_IN_CLASS(Name) friend inline void enableEnumFlags(Name) {}
2220

2321

2422
#endif // ENUM_CLASS_ALLOW_FLAGS_HPP

0 commit comments

Comments
 (0)