I'm looping through some input and output strings for a unit test, and my first attempt was:
std::vector<std::pair<std::string, std::string>> pairs {{"input1", "output1"}, {"input2", "output2"}};
As you can see it's quite verbose. I've tried to use auto, but g++ complains about the nested init lists.
How can this be simplified?
I realize this might not be the recommended data structure for the job (you could use a std::map for instance) I'm asking this out of pure curiosity.
Aucun commentaire:
Enregistrer un commentaire