summaryrefslogtreecommitdiff
path: root/datastructures/bitset.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'datastructures/bitset.cpp')
-rw-r--r--datastructures/bitset.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/datastructures/bitset.cpp b/datastructures/bitset.cpp
new file mode 100644
index 0000000..9f33a5b
--- /dev/null
+++ b/datastructures/bitset.cpp
@@ -0,0 +1,7 @@
+bitset<10> bits(0b000010100);
+cout << bits._Find_first() << endl; //2
+cout << bits._Find_next(2) << endl; //4
+cout << bits._Find_next(4) << endl; //10 bzw. N
+bits[x] = 1; //not bits.set(x)!
+bits[x] = 0; //not bits.reset(x)!
+bits[x].flip(); //not bits.flip(x)!