A vector of pairs is better represented as a map. Since your names are unique, I think we should change this to std::map < std::string, message >