I have following data type
typedef std::map <std::string.std::string> leaf;
typedef std::map <std::string,leaf> child;
typedef std::vector<child> parent;
Now if I want access parent element at index 0 and child element having key "x" and then perform some operation of it's values
First way of doing this will be like:
parentobject[0]["x"]["r"]
But every time I need to repeat these index whenever I want access that value.
Second way of doing this will be like: std::string value=parentobject[0]["x"]["r"] Then use value object. But problem with this approach is this line will create copy of the string.
Is there a better way to access variable without creating copy?