Public Types | |
| typedef int | key_type |
| typedef int | value_type |
| typedef std::less< key_type > | key_compare |
| typedef key_compare | value_compare |
| typedef value_type | reference |
| typedef const value_type | const_reference |
| typedef unsigned int | size_type |
| typedef int | difference_type |
| typedef value_type * | pointer |
| typedef const value_type * | const_pointer |
|
typedef std::reverse_iterator< iterator > | reverse_iterator |
|
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
| typedef unsigned int | data_type |
Public Member Functions | |
| Bitset (size_type max) | |
| Default constructor. | |
| Bitset (size_type max, const data_type *data) | |
| Constructor with user-provided bit field. | |
| Bitset (const Bitset &bs) | |
| Copy constructor. | |
| template<class InputIterator> | |
| Bitset (InputIterator first, InputIterator last) | |
| Constructor from Input Iterators. | |
| ~Bitset () | |
| Standard destructor. | |
| Bitset & | operator= (const Bitset &rhs) |
| Affectation. | |
| bool | empty () const |
| size_type | size () const |
| size_type | max_size () const |
| void | swap (Bitset &other) |
| Swap with another Bitset. | |
| void | clear () |
| Clear the set. | |
| key_compare | key_comp () const |
| value_compare | value_comp () const |
| iterator | find (const key_type &x) const |
| Find an element in the set. | |
| size_type | count (const key_type &x) const |
| Used for compatibility with std::set. Returns 0 or 1. | |
| iterator | lower_bound (const key_type &x) const |
| iterator | upper_bound (const key_type &x) const |
| std::pair< iterator, iterator > | equal_range (const key_type &x) const |
| bool | operator== (const Bitset &rhs) const |
| bool | operator< (const Bitset &rhs) const |
| bool | operator!= (const Bitset &rhs) const |
| bool | operator> (const Bitset &rhs) const |
| bool | operator>= (const Bitset &rhs) const |
| bool | operator<= (const Bitset &rhs) const |
| Bitset | operator & (const Bitset &rhs) const |
| Bitset | operator| (const Bitset &rhs) const |
| bool | operator[] (const key_type &x) const |
| Returns the xth bit. | |
| Bitset | project (const Bitset &b) const |
| Project the set onto another bitset. The result is space-optimized. | |
| Bitset | unproject (const Bitset &b) const |
| Inverse function of project. | |
| unsigned | to_unsigned () const |
| Reinterpret bits as unsigned int. | |
| template<typename Type> | |
| const Type | cast () const |
| Reinterpret bits as another type. | |
| std::ostream & | print (std::ostream &ostr) const |
| Print the set. | |
| iterator | begin () |
| Iterators. | |
| const_iterator | begin () const |
| Iterators. | |
| iterator | end () |
| Iterators. | |
| const_iterator | end () const |
| Iterators. | |
| reverse_iterator | rbegin () |
| Reverse iterators. | |
| const_reverse_iterator | rbegin () const |
| Reverse iterators. | |
| reverse_iterator | rend () |
| Reverse iterators. | |
| const_reverse_iterator | rend () const |
| Reverse iterators. | |
| std::pair< iterator, bool > | insert (const value_type &x) |
| Insert an element into the set. | |
| iterator | insert (iterator position, const value_type &x) |
| Insert an element into the set. | |
| template<class InputIterator> | |
| void | insert (InputIterator first, InputIterator last) |
| Insert an element into the set. | |
| void | erase (iterator position) |
| Erase an element from the set. | |
| size_type | erase (const key_type &x) |
| Erase an element from the set. | |
| void | erase (iterator first, iterator last) |
| Erase an element from the set. | |
Protected Types | |
| enum | |
Protected Member Functions | |
| bool | get_bit (size_type index, size_type bit) const |
| Get a bit inside data_. | |
| size_type | compute_size () const |
| Recalculate the set's size when invalid. | |
| bit_iterator | bit_begin () const |
| const bit_iterator & | bit_end () const |
| bool | get_bit (const bit_iterator &it) const |
| Get a bit inside data_ given an iterator. | |
| template<class BitAction> | |
| bool | do_on_bit (BitAction &action, const key_type &x) |
| Perform an action onto the bit corresponding to an element. | |
| template<class BitAction> | |
| bool | do_on_bit (BitAction &action, const bit_iterator &it) |
| Perform an action onto the bit corresponding to an element. | |
| template<class ConstBitAction> | |
| bool | do_on_bit (ConstBitAction &action, const key_type &x) const |
| Perform an action onto the bit corresponding to an element, const. | |
| template<class ConstBitAction> | |
| bool | do_on_bit (ConstBitAction &action, const bit_iterator &it) const |
| Perform an action onto the bit corresponding to an element, const. | |
Static Protected Member Functions | |
| static size_type | get_data_size (size_type max) |
| Calculates the number of data_type needed for the set. | |
| static size_type | get_index (const key_type &x) |
| Get the index of x in the data_ attribute. | |
| static size_type | get_bitnum (const key_type &x) |
| Get the bit number of x inside the data_[i] attribute. | |
Protected Attributes | |
| size_type | data_size_ |
| data_type * | data_ |
| size_type | max_size_ |
| size_type | size_ |
| bit_iterator | end_ |
Classes | |
| struct | bit_iterator |
| struct | BitActionCount |
| struct | const_iterator |
| struct | iterator |
This is a dynamic bitset implementation which behave almost like a std::set<int>.
Definition at line 45 of file bitset.hh.
Default constructor.
| max | The highest integer which could be inserted into the set. |
Definition at line 43 of file bitset.hxx.
References Bitset::data_, and Bitset::data_size_.
Inverse function of project.
S.project (T).unproject (T) == S cap T
Definition at line 558 of file bitset.hxx.
References assertion, Bitset::bit_begin(), Bitset::bit_end(), Bitset::do_on_bit(), Bitset::get_bit(), Bitset::max_size(), and Bitset::BitActionCount::value.
1.4.7