Line | |
---|
1 | // (C) Copyright Jeremy Siek 2001. |
---|
2 | // Distributed under the Boost Software License, Version 1.0. (See |
---|
3 | // accompanying file LICENSE_1_0.txt or copy at |
---|
4 | // http://www.boost.org/LICENSE_1_0.txt) |
---|
5 | |
---|
6 | // Sample output: |
---|
7 | // 1 |
---|
8 | // 1 |
---|
9 | // 0 |
---|
10 | // 0 |
---|
11 | // 1 |
---|
12 | |
---|
13 | #include <iostream> |
---|
14 | #include <boost/dynamic_bitset.hpp> |
---|
15 | int main() { |
---|
16 | boost::dynamic_bitset<> x(5); // all 0's by default |
---|
17 | x[0] = 1; |
---|
18 | x[1] = 1; |
---|
19 | x[4] = 1; |
---|
20 | for (boost::dynamic_bitset<>::size_type i = 0; i < x.size(); ++i) |
---|
21 | std::cout << x[i]; |
---|
22 | std::cout << "\n"; |
---|
23 | std::cout << x << "\n"; |
---|
24 | return EXIT_SUCCESS; |
---|
25 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.