MCPcopy Create free account
hub / github.com/Neargye/magic_enum / main

Function main

example/example_containers_bitset.cpp:39–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37};
38
39int main() {
40
41 auto color_bitset = magic_enum::containers::bitset<Color>();
42 color_bitset.set(Color::GREEN);
43 color_bitset.set(Color::BLUE);
44
45 std::cout << std::boolalpha;
46 std::cout << color_bitset.size() << std::endl; // 3 == magic_enum::enum_count<Color>()
47 std::cout << color_bitset.all() << std::endl; // false
48 std::cout << color_bitset.any() << std::endl; // true
49 std::cout << color_bitset.none() << std::endl; // false
50 std::cout << color_bitset.count() << std::endl; // 2
51 std::cout << color_bitset.test(Color::RED) << std::endl; // false
52 std::cout << color_bitset.test(Color::GREEN) << std::endl; // true
53 std::cout << color_bitset.test(Color::BLUE) << std::endl; // true
54
55 return 0;
56}

Callers

nothing calls this directly

Calls 7

anyMethod · 0.80
testMethod · 0.80
setMethod · 0.45
sizeMethod · 0.45
allMethod · 0.45
noneMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected