We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ad8d3f6 commit 6b5cd5cCopy full SHA for 6b5cd5c
cpp_11/003_stl_std_hash_std_bitset.cpp
@@ -1 +1,19 @@
1
-1
+#include <bitset>
2
+#include <iostream>
3
+#include <functional>
4
+
5
+int main()
6
+{
7
+ std::bitset<4> b1{0}, b2{42};
8
+ std::bitset<8> b3{0}, b4{42};
9
10
+ std::hash<std::bitset<4>> hash_fn4;
11
+ std::hash<std::bitset<8>> hash_fn8;
12
+ using bin64 = std::bitset<64>;
13
14
+ std::cout
15
+ << bin64{hash_fn4(b1)} << " = " << hash_fn4(b1) << '\n'
16
+ << bin64{hash_fn4(b2)} << " = " << hash_fn4(b2) << '\n'
17
+ << bin64{hash_fn8(b3)} << " = " << hash_fn8(b3) << '\n'
18
+ << bin64{hash_fn8(b4)} << " = " << hash_fn8(b4) << '\n';
19
+}
0 commit comments