11 Dec
2014
11 Dec
'14
9:14 a.m.
Hi there, Is there any library in Boost that provides type-safe enum bit flags? Something like below: enum class option { a = 1, b = 2, c = 4, .... }; DEFINE_FLAGS(options, option); options set1 = option::a | option::b; options set2 = set1 | option::c; options err1 = option::a | 2; // error options err2 = set2 | 2; // error if (set1 & option::a) {...} if (set1 & 2) {...} // error Thanks.