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

#include <rev.h>

Inheritance diagram for operations_research::RevMap< Map >:
operations_research::ReversibleInterface

Public Types

typedef Map::key_type key_type
 
typedef Map::mapped_type mapped_type
 
typedef Map::value_type value_type
 
typedef Map::const_iterator const_iterator
 

Public Member Functions

void SetLevel (int level) final
 
int Level () const
 
bool contains (key_type key) const
 
const mapped_typeat (key_type key) const
 
void EraseOrDie (key_type key)
 
void Set (key_type key, mapped_type value)
 
int size () const
 Wrapper to the underlying const map functions.
 
bool empty () const
 
const_iterator find (const key_type &k) const
 
const_iterator begin () const
 
const_iterator end () const
 

Detailed Description

template<class Map>
class operations_research::RevMap< Map >

Like a normal map but support backtrackable operations.

This works on any class "Map" that supports: begin(), end(), find(), erase(), insert(), key_type, value_type, mapped_type and const_iterator.

Definition at line 156 of file rev.h.

Member Typedef Documentation

◆ const_iterator

template<class Map >
Map::const_iterator operations_research::RevMap< Map >::const_iterator

Definition at line 161 of file rev.h.

◆ key_type

template<class Map >
Map::key_type operations_research::RevMap< Map >::key_type

Definition at line 158 of file rev.h.

◆ mapped_type

template<class Map >
Map::mapped_type operations_research::RevMap< Map >::mapped_type

Definition at line 159 of file rev.h.

◆ value_type

template<class Map >
Map::value_type operations_research::RevMap< Map >::value_type

Definition at line 160 of file rev.h.

Member Function Documentation

◆ at()

template<class Map >
const mapped_type & operations_research::RevMap< Map >::at ( key_type key) const
inline

Definition at line 173 of file rev.h.

◆ begin()

template<class Map >
const_iterator operations_research::RevMap< Map >::begin ( ) const
inline

Definition at line 182 of file rev.h.

◆ contains()

template<class Map >
bool operations_research::RevMap< Map >::contains ( key_type key) const
inline

Definition at line 172 of file rev.h.

◆ empty()

template<class Map >
bool operations_research::RevMap< Map >::empty ( ) const
inline

Definition at line 180 of file rev.h.

◆ end()

template<class Map >
const_iterator operations_research::RevMap< Map >::end ( ) const
inline

Definition at line 183 of file rev.h.

◆ EraseOrDie()

template<class Map >
void operations_research::RevMap< Map >::EraseOrDie ( key_type key)

Definition at line 227 of file rev.h.

◆ find()

template<class Map >
const_iterator operations_research::RevMap< Map >::find ( const key_type & k) const
inline

Definition at line 181 of file rev.h.

◆ Level()

template<class Map >
int operations_research::RevMap< Map >::Level ( ) const
inline

Definition at line 170 of file rev.h.

◆ Set()

template<class Map >
void operations_research::RevMap< Map >::Set ( key_type key,
mapped_type value )

It is an insertion. Undo = delete.

It is a modification. Undo = change back to old value.

Definition at line 237 of file rev.h.

◆ SetLevel()

template<class Map >
void operations_research::RevMap< Map >::SetLevel ( int level)
finalvirtual

Backtracking support: changes the current "level" (always non-negative).

Initially the class starts at level zero. Increasing the level works in O(level diff) and 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.

This is ok even if level == Level().

Implements operations_research::ReversibleInterface.

Definition at line 205 of file rev.h.

◆ size()

template<class Map >
int operations_research::RevMap< Map >::size ( ) const
inline

Wrapper to the underlying const map functions.

Definition at line 179 of file rev.h.


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