vg
tools for working with variation graphs
|
#include <utility.hpp>
Classes | |
struct | const_iterator |
Random access iterator. More... | |
Public Member Functions | |
VectorView () | |
~VectorView ()=default | |
VectorView (const VectorView &other)=default | |
VectorView (VectorView &&other)=default | |
VectorView & | operator= (const VectorView &other)=default |
VectorView & | operator= (VectorView &&other)=default |
VectorView (const vector< Item > &items) | |
VectorView (const vector< Item > &items, const vector< size_t > &indexes) | |
const Item & | operator[] (size_t index) const |
size_t | backing_index (size_t index) const |
size_t | size () const |
bool | empty () const |
void | with_vector (const std::function< void(const vector< Item > &)> &callback) const |
void | with_vector (const std::function< void(vector< Item > &)> &callback) |
const_iterator | begin () const |
Get iterator to first item. More... | |
const_iterator | end () const |
Get iterator to past-end item. More... | |
Public Attributes | |
const vector< Item > * | items |
const vector< size_t > * | indexes |
We want to be able to operate on reordered subset of things without moving the originals, so we use this view over things stored in a vector.
Both the backing collection and the indexes must outlive the view.
Copyable and assignable, and default-constructable to an empty state.
|
inline |
|
default |
|
default |
|
default |
|
inline |
Make a VectorView of a whole vector. Provides an implicit conversion.
|
inline |
Make a VectorView of a reordered subset of a vector.
|
inline |
Get the backing index of an item by index.
|
inline |
Get iterator to first item.
|
inline |
Determine if there are no items.
|
inline |
Get iterator to past-end item.
|
default |
|
default |
|
inline |
Get an item by index.
|
inline |
Get the total number of items.
|
inline |
Call the given callback with a dense and properly ordered vector of the items.
|
inline |
Call the given callback with a dense and properly ordered vector of the items, which can be modified. Modification will not be visible in the backing storage.
TODO: will this be called even when the const version could be more efficiently used?
const vector<size_t>* vg::VectorView< Item >::indexes |
const vector<Item>* vg::VectorView< Item >::items |