I'm writing a program that will pull a variable amount of data from a server. There are three different structs I will be using to hold three different sets of variables (though I'd like to know if this can be done with a class as well). Because different servers will have varying amounts of sets of data, I'd like to be able to name structs with strings or be able to do something similar.
Is there any way to go about this, or any good practice to do something similar? Thanks in advance.
Quick example:
struct foo {
std::string name;
std::string ipAddress;
std::string macAddress;
};
struct bar {
std::string dhcpServer;
std::string tftpServer;
};
foo [string_as_name_one];
bar [string_as_name_two];
I'm hoping to name structs arbitrarily. map
looks similar to what I'm looking for, so I'm reading into that a bit right now.
Thanks for the help and quick response, map
was exactly what I was looking for.