caretaker.cc 229 B

123456789101112
  1. #include "caretaker.hh"
  2. void CareTaker::add(Memento* state){
  3. mementoList.push_back(state);
  4. }
  5. Memento* CareTaker::get(int index){
  6. std::list<Memento*>::iterator it = mementoList.begin();
  7. advance(it, index);
  8. return *it;
  9. }