Basically, you have to create the associations in your code. Parse the input into the structure / field values (e.g. inputstringstream >> structure >> separator >> field), then have something like:
if (structure == "emp")
if (field == "empid")
...do something with emp[which_one].empid...
...
If you need to separate these steps of resolving the reference from the code that uses the values, then you may wish to have the above code (i.e. the "do something") set a functor that you can call later when you want the actual value.
To provide more structure to essentially the same approach, you could potentially enhance each structure with an API that knows about its fields:
struct Emp
{
// boost::any can directly return an int, string, double etc...
// you could hack your own union to do this if you needed, or provide
// some common base class around these types
boost::any get(const std::string& identifier) const;
// this one might use std::ostringstream to convert any non-string fields
// into a textual representation, but e.g. you can loose precision
// from floating point values
std::string get(const std::string& identifier) const;
};
You could then put the different accessors into one map...
struct Field_Access
{
virtual boost::any get(const std::string& identifier) const = 0;
virtual bool set(const std::string& identifier, const std::string& value) = 0;
virtual bool set(const std::string& identifier, const int& value) = 0;
};
struct Emp : Field_Access
{
...
};
std::map<std::string, Field_Access*> accessors;
... populate accessors ...
accessors["emp"] = emp;
accessors["emp"][which_one].get("empid");
The possibilities are pretty endless, and your question not specific enough to provide very targetted advice.