Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bitset>
- namespace {
- namespace Source {
- // not an enum class because these have no implicit conversion to int
- enum Type {
- analog_radio,
- internet_radio,
- bluetooth
- };
- // keep updated when adding new Type
- constexpr std::size_t size()
- {
- return Source::bluetooth + 1;
- }
- }
- typedef std::bitset<Source::size()> SourceSet;
- }
- int main()
- {
- SourceSet attributes;
- attributes[Source::analog_radio] = true;
- attributes[Source::bluetooth] = true;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement