DOLFIN
DOLFIN C++ interface
|
#include <RangedIndexSet.h>
Public Member Functions | |
RangedIndexSet (std::pair< std::size_t, std::size_t > range) | |
Create a ranged set with range given as a (lower, upper) pair. | |
RangedIndexSet (std::size_t upper_range) | |
Create a ranged set with 0 as lower range. | |
bool | in_range (std::size_t i) const |
Return true if a given index is within range, i.e., if it can be stored in the set. | |
bool | has_index (std::size_t i) const |
Check is the set contains the given index. | |
bool | insert (std::size_t i) |
void | erase (std::size_t i) |
Erase an index from the set. | |
void | clear () |
Erase all indices from the set. | |
This class provides an special-purpose data structure for testing if a given index within a range is set. It is very fast.
The memory requirements are one bit per item in range, since it uses a (packed) std::vector<bool> for storage.
|
inline |
Insert a given index into the set. Returns true if the index was inserted (i.e., the index was not already in the set).