It is a little more elegant (and slightly more efficient) to say materials_.back()->getName() instead of materials_[materials_.size() - 1]->getName()