memento_pattern::Caretaker

class Caretaker

The Caretaker class manages Memento objects.

Public Functions

inline void addMemento(std::unique_ptr<Memento> memento)

Adds a Memento to the list.

Parameters:

memento – The Memento to add.

inline const Memento &getMemento(size_t index) const

Retrieves a Memento by index.

Parameters:

index – The index of the desired Memento.

Throws:

std::out_of_range – if the index is invalid.

Returns:

A reference to the Memento at the specified index.