A 2D vector implementation optimized for sparse data. More...
#include <vector2D.hpp>
Public Member Functions | |
skipzero_span< T > | operator[] (row_id_t id) |
Accesses a row in the 2D vector. | |
skipzero_span< const T > | operator[] (row_id_t id) const |
Accesses a row in the 2D vector (const version). | |
T * | begin (row_id_t id) |
Gets the beginning iterator for a specific row. | |
T * | end (row_id_t id) |
Gets the end iterator for a specific row. | |
const T * | begin (row_id_t id) const |
Gets the beginning const iterator for a specific row. | |
const T * | end (row_id_t id) const |
Gets the end const iterator for a specific row. | |
row_size_t | getRowSize (row_id_t id) const |
Gets the size of a specific row. | |
row_size_t | getRowsCount () const |
Gets the number of rows in the 2D vector. | |
void | push_row (const std::vector< int > &row) |
Adds a new row to the 2D vector. | |
void | emplace_row (std::initializer_list< int > row) |
Adds a new row to the 2D vector using an initializer list. | |
void | delete_row (row_id_t id) |
Marks a row as deleted. | |
bool | delete_element (row_id_t rowId, row_size_t offset) |
Deletes an element in a specific row. | |
void | cleanup () |
Cleans up the 2D vector by removing deleted rows and compacting data. | |
A 2D vector implementation optimized for sparse data.
T | The type of elements in the vector (must be arithmetic). |
|
inline |
Gets the beginning iterator for a specific row.
id | The row ID. |
|
inline |
Gets the beginning const iterator for a specific row.
id | The row ID. |
bool painless::vector2D< T >::delete_element | ( | row_id_t | rowId, |
row_size_t | offset ) |
Deletes an element in a specific row.
rowId | The ID of the row. |
offset | The offset of the element in the row. |
|
inline |
Marks a row as deleted.
id | The ID of the row to be deleted. |
void painless::vector2D< T >::emplace_row | ( | std::initializer_list< int > | row | ) |
Adds a new row to the 2D vector using an initializer list.
row | The row to be added as an initializer list. |
|
inline |
Gets the end iterator for a specific row.
id | The row ID. |
|
inline |
Gets the end const iterator for a specific row.
id | The row ID. |
|
inline |
Gets the number of rows in the 2D vector.
|
inline |
Gets the size of a specific row.
id | The row ID. |
|
inline |
|
inline |
Accesses a row in the 2D vector (const version).
id | The row ID. |
void painless::vector2D< T >::push_row | ( | const std::vector< int > & | row | ) |
Adds a new row to the 2D vector.
row | The row to be added. |