

Public Member Functions | |
| Bitset () | |
| An empty set, without preallocated storage. | |
| Bitset (int n, bool full=false) | |
| An empty set with preallocated storage for elements 0..n-1. | |
| Bitset (const GenericSet< Bitset > &s) | |
| Copy of a disguised Bitset object. | |
| template<typename _Set> | |
| Bitset (const GenericSet< _Set, int > &s) | |
| Copy of an abstract set of integers. | |
| template<typename _Set, typename E2, typename Comparator2> | |
| Bitset (const GenericSet< _Set, E2, Comparator2 > &s) | |
| Copy of an abstract set with element conversion. | |
| Bitset & | operator= (const GenericSet< Bitset > &s) |
| Assign elements from a disguised Bitset object. | |
| void | reserve (int n) |
| Reserve storage for n elements. | |
| void | clear () |
| Make the set empty. | |
| template<typename _Set> | |
| Bitset & | operator= (const GenericSet< _Set, int > &s) |
| Assign elements from an abstract set of integers. | |
| int | size () const |
| Bitset & | operator+= (int i) |
| Bitset & | operator-= (int i) |
| Bitset & | operator-= (const Bitset &s) |
| difference | |
| Bitset & | operator*= (const Bitset &s) |
| intersection | |
Friends | |
| Bitset | operator| (const Bitset &s1, const Bitset &s2) |
| alias for operator+ | |
| Bitset | operator & (const Bitset &s1, const Bitset &s2) |
| alias for operator* | |
A special class optimized for representation of a constrained range of non-negative integer numbers. Its implementation is based on the GMP (mpz_t), see http://www.swox.com/gmp/ You should consider to use it instead of the more general Set<int> if all these criteria hold:
Note that unlike std::bitset, the element range is not hard encoded in the Bitset object, but can be dynamically changed any time.
Bitset is one of the few top-level classes in the Polymake Template Library that does not make use of reference counted smart pointers. It's difficult to say why. You should keep this in mind if you want to copy or return Bitset objects by value.
| pm::Bitset::Bitset | ( | int | n, | |
| bool | full = false | |||
| ) | [inline, explicit] |
An empty set with preallocated storage for elements 0..n-1.
It can dynamically grow beyond this limit if needed; to avoid performance penalties, however, you should specify here the highest element you really expect to occur.
| n | ||
| full | Set this to 1 if the set contains all elements from 0 to n-1, defaults to 0. |
| int pm::Bitset::size | ( | ) | const [inline] |
Count the elements. CAUTION: depending on the hardware, can take O(n) time!
| Bitset& pm::Bitset::operator+= | ( | int | i | ) | [inline] |
Insert an element. This is the quickest way to manipulate single elements.
| Bitset& pm::Bitset::operator-= | ( | int | i | ) | [inline] |
Remove an element if it existed. This is the quickest way to manipulate single elements.