diff --git a/src/collections.cc b/src/collections.cc index af0e7bbc..6442c581 100644 --- a/src/collections.cc +++ b/src/collections.cc @@ -38,10 +38,10 @@ Collections::Collections() { Collections::~Collections() { - for (auto &a : *this) { - this->erase(a.first); - delete a.second; + for (const auto &thing : *this) { + delete thing.second; } + this->clear(); } diff --git a/src/variables.cc b/src/variables.cc index 507a0721..325fbac5 100644 --- a/src/variables.cc +++ b/src/variables.cc @@ -35,9 +35,7 @@ Variables::Variables() { } Variables::~Variables() { - for (auto &a : *this) { - this->erase(a.first); - } + this->clear(); } void Variables::store(std::string key, std::string value) {