vg
tools for working with variation graphs
Public Member Functions | Private Attributes | List of all members
vg::VectorViewInverse Class Reference

#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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ VectorViewInverse() [1/2]

vg::VectorViewInverse::VectorViewInverse ( )
inline

Default-construct an inverse of nothing.

◆ VectorViewInverse() [2/2]

template<typename Item >
vg::VectorViewInverse::VectorViewInverse ( const VectorView< Item > &  view)
inline

Invert the given VectorView.

Member Function Documentation

◆ operator[]()

size_t vg::VectorViewInverse::operator[] ( size_t  backing_index)
inline

Get the view index from a backing index.

Member Data Documentation

◆ inverse

vector<size_t> vg::VectorViewInverse::inverse
private

Stores the index in the view at which each item in the backing storage appears.


The documentation for this class was generated from the following file: