Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::RevVector< IndexType, T > Class Template Reference

A basic reversible vector implementation. More...

#include <rev.h>

Inheritance diagram for operations_research::RevVector< IndexType, T >:
operations_research::ReversibleInterface

Public Member Functions

const T & operator[] (IndexType index) const
 
T & MutableRef (IndexType index)
 
int size () const
 
void Grow (int new_size)
 
void GrowByOne ()
 
int Level () const
 
void SetLevel (int level) final
 
- Public Member Functions inherited from operations_research::ReversibleInterface
 ReversibleInterface ()
 
virtual ~ReversibleInterface ()
 

Detailed Description

template<class IndexType, class T>
class operations_research::RevVector< IndexType, T >

A basic reversible vector implementation.

Definition at line 89 of file rev.h.

Member Function Documentation

◆ Grow()

template<class IndexType , class T >
void operations_research::RevVector< IndexType, T >::Grow ( int new_size)
inline

Definition at line 104 of file rev.h.

◆ GrowByOne()

template<class IndexType , class T >
void operations_research::RevVector< IndexType, T >::GrowByOne ( )
inline

Definition at line 109 of file rev.h.

◆ Level()

template<class IndexType , class T >
int operations_research::RevVector< IndexType, T >::Level ( ) const
inline

Definition at line 111 of file rev.h.

◆ MutableRef()

template<class IndexType , class T >
T & operations_research::RevVector< IndexType, T >::MutableRef ( IndexType index)
inline
Todo
(user): Maybe we could have also used the [] operator, but it is harder to be 100% sure that the mutable version is only called when we modify the vector. And I had performance bug because of that.

Save on the stack first.

Definition at line 96 of file rev.h.

◆ operator[]()

template<class IndexType , class T >
const T & operations_research::RevVector< IndexType, T >::operator[] ( IndexType index) const
inline

Definition at line 91 of file rev.h.

◆ SetLevel()

template<class IndexType , class T >
void operations_research::RevVector< IndexType, T >::SetLevel ( int level)
inlinefinalvirtual

Initially a reversible class starts at level zero. Increasing the level saves the state of the current old level. Decreasing the level restores the state to what it was at this level and all higher levels are forgotten. Everything done at level zero cannot be backtracked over.

The level is assumed to be non-negative.

Implements operations_research::ReversibleInterface.

Definition at line 113 of file rev.h.

◆ size()

template<class IndexType , class T >
int operations_research::RevVector< IndexType, T >::size ( ) const
inline

Definition at line 102 of file rev.h.


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