I am working on a legacy code, there is a class A which has an enum member defined like this
class A
{
private:
enum E{ kRemove, kDoNotRemove};
static map<String, MapValue> s_Map; //this map I am trying to add
}
I am trying to add a map in this class which will have structure as a value something like this
struct MapValue{
E e; //this enum is defined in private section in the class
String T;
String F;
} ;
What I am unable to understand where should I define this struct MapValue?
My understanding:
- If I add it inside the class Whenever I will create an object, a struct var will be allocated. This is not useful, as I am using this struct only as the value for the map. Also it is not the case that I need only one copy of this struct as I am using it as a value in the map.
- If I add it outside the class, it will not be a good design as the struct is only inside the class, so it should not be global. Also the struct has enum member which is defined as private in the class, so it is not accessible outside the class.
Please suggest.