I have to store 3 strings per variable, but don't know which is the best data structure to use for that in C++.
I can think of only Struct, but not sure if it is the best way to do it.
Something like string var[100][3], first dimension(100) should be dynamically add and remove.
I tried all sorts of things with map, multimap.
Any help is appreciated. Thank you
If you have always exactly 3 strings together in a triplet and want to have multiple triplets, then define struct with three strings and put it to std::vector
.
struct Triplet {
std::string a,b,c;
};
std::vector<Triplet> data;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With