|
Brick Library 0.1
Performance-portable stencil datalayout & codegen
|
Set using bitfield. More...
#include <bitset.h>
Public Member Functions | |
| BitSet () | |
| Default to empty set. | |
| BitSet (uint64_t s) | |
| Initialize a set based on an unsigned bitfield. | |
| BitSet (std::initializer_list< int > l) | |
| Initialize a set based on a list of numbers. | |
| BitSet & | flip (long pos) |
| Flipping an element. | |
| long | size () const |
| The number of elements currently stored in the set. | |
| bool | get (long pos) const |
| Return whether a number is in the set. | |
| BitSet | operator& (BitSet a) const |
| Intersection with another set. | |
| BitSet | operator| (BitSet a) const |
| Union with another set. | |
| BitSet | operator^ (BitSet a) const |
| \(A \cup B - A \cap B\) | |
| operator bool () const | |
| Test emptiness, true if not empty. | |
| bool | operator<= (BitSet a) const |
| True if \(A \subseteq B\). | |
| bool | operator>= (BitSet a) const |
| True if \(A \supseteq B\). | |
| BitSet | operator! () const |
| Negate all elements in the set, not a set operation. | |
Static Public Member Functions | |
| static uint64_t | to_set (long pos) |
| Turn number into corresponding element of set. | |
Public Attributes | |
| uint64_t | set |
| The bitfield of this set. | |
Static Public Attributes | |
| static const long | zero = 31 |
| negative zero start at 31 (1<<31). | |
Related Functions | |
(Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &os, const BitSet &bs) |
| Print a bit set. | |
| std::istream & | operator>> (std::istream &is, BitSet &bs) |
| Read a bit set. | |
Set using bitfield.
Numbers are translated into elements and then stored in the bitfield. Can only held numbers in \([-32,31]\).
|
inline |
Default to empty set.
|
inline |
Initialize a set based on an unsigned bitfield.
|
inline |
|
inline |
Flipping an element.
| pos | the number |
Add the element if not exist, or remove it if it does.
|
inline |
Return whether a number is in the set.
|
inline |
Test emptiness, true if not empty.
|
inline |
|
inline |
True if \(A \subseteq B\).
|
inline |
True if \(A \supseteq B\).
|
inline |
The number of elements currently stored in the set.
|
inlinestatic |
Turn number into corresponding element of set.
| pos | Input number |
|
related |
Print a bit set.
Example:
|
related |
Read a bit set.
Input is the same format as output. Numbers are separated by appended sign.
| uint64_t BitSet::set |
The bitfield of this set.
|
static |
negative zero start at 31 (1<<31).