Hi,
I have a class myclass that has a private member param_map
class some_class {
private:
std::map<std::string,std::shared_ptr<parameter> > param_map;
};
I want to expose this map to allow other classes, I have already created add, delete, get parameter methods, which do, what you think. But I would like to expose this so other classes can traverse the map.
Q1: What would be the safest way to do this.
parameter also has a member value that I want to be either int/float/bool so one option would be to define it using templates
template<class T>
class parameter {
public:
T get_value { return value_; }
private:
T value_;
}
Q2: But how would I store this type in the map? And how would it change the definition of param_map. Also I would consider non template solutions (But I would prefer just one map)
PS: I would rather avoid using boost, I prefer to use the c++x0 std lib, but if boost is the best option then I will consider that. It would be good if you could post code examples also.
Regards
Mark