Efficient (compressed-row) storage for a sequence of sequences of integers. More...
Public Member Functions | |
template<class InputIt > | |
void | add_row (InputIt first, InputIt last) |
Append onto the crs (via data copy) a row of values pointed to by a beginning and an ending iterator. | |
template<typename Range > | |
void | add_row (Range const &it) |
Append onto the crs (via data copy) a row of values acquired by traversing a range. | |
template<class U > | |
void | add_row (std::initializer_list< U > init) |
Append onto the crs (via data copy) a row of values. | |
void | clear () |
Discard all data (offsets and values ). | |
crs ()=default | |
Create an empty sequence of sequences. | |
std::size_t | size () const |
Return the number of rows. | |
util::span< const util::gid > | operator[] (std::size_t i) const |
Return a row. | |
util::span< util::gid > | operator[] (std::size_t i) |
Return a row. | |
Public Attributes | |
util::offsets | offsets |
The rows in values . | |
std::vector< util::gid > | values |
The concatenated rows. | |
Efficient (compressed-row) storage for a sequence of sequences of integers.
There are no constraints on the size or contents of either the sequences or sequences of sequences: sequences can be different sizes, can have overlapping values, can include values in any order, and can hold duplicate values.
This type is a random-access range of span
objects. Because the offsets
and values
fields must be kept in sync they are best treated as read-only. Use the add_row
methods to modify those fields in a consistent manner.
|
default |
Create an empty sequence of sequences.
void add_row | ( | InputIt | first, |
InputIt | last ) |
Append onto the crs
(via data copy) a row of values pointed to by a beginning and an ending iterator.
void add_row | ( | std::initializer_list< U > | init | ) |
Append onto the crs
(via data copy) a row of values.
void add_row | ( | Range const & | it | ) |
Append onto the crs
(via data copy) a row of values acquired by traversing a range.
std::size_t size | ( | ) | const |
Return the number of rows.
void clear | ( | ) |
Discard all data (offsets
and values
).
util::span< const util::gid > operator[] | ( | std::size_t | i | ) | const |
Return a row.
values
util::span< util::gid > operator[] | ( | std::size_t | i | ) |
Return a row.
values
The rows in values
.
std::vector<util::gid> values |
The concatenated rows.