diff options
Diffstat (limited to 'content/datastructures/bitset.cpp')
| -rw-r--r-- | content/datastructures/bitset.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/content/datastructures/bitset.cpp b/content/datastructures/bitset.cpp new file mode 100644 index 0000000..d19abb0 --- /dev/null +++ b/content/datastructures/bitset.cpp @@ -0,0 +1,7 @@ +bitset<10> bits(0b000010100); +bits._Find_first(); //2 +bits._Find_next(2); //4 +bits._Find_next(4); //10 bzw. N +bits[x] = 1; //not bits.set(x) or bits.reset(x)! +bits[x].flip(); //not bits.flip(x)! +bits.count(); //number of set bits |
