vg
tools for working with variation graphs
|
#include <utility.hpp>
Public Member Functions | |
VectorViewInverse () | |
Default-construct an inverse of nothing. More... | |
template<typename Item > | |
VectorViewInverse (const VectorView< Item > &view) | |
Invert the given VectorView. More... | |
size_t | operator[] (size_t backing_index) |
Private Attributes | |
vector< size_t > | inverse |
Stores the index in the view at which each item in the backing storage appears. More... | |
Represents the reverse of the view transformation used in a VectorView.
Assumes we have the memory for a dense inverse, and that nobody will ever ask about values that aren't actually in the view. If an item appears multiple times, one index will win.
If the VectorView's backing vectors are modified, the inverse will need to be re-made.
In keeping with VectorView's value semantics, the inverted VectorView does not need to outlivce this object.
|
inline |
Default-construct an inverse of nothing.
|
inline |
Invert the given VectorView.
|
inline |
Get the view index from a backing index.
|
private |
Stores the index in the view at which each item in the backing storage appears.