Just some further thought here. I tried to return a pointer via a function so that I wasn't having to create a copy everywhere and everytime I needed to access it. Upon reflecting yesterday evening, I realised that returning it like this, the container might be going out of scope at the function return, and is therefore destroyed. I.e.
// let's say parent is class level container somewhere
BaseContainer *bc = Get_ContainerP();
if(bc == nullptr)
// bc passes nullptr check because the address was valid
if(bc->GetBool(MY_CHILD_BOOL,FALSE) == TRUE)
// crashes here with an access violation because the container was destroyed when the scope stopped after the Get_ContainerP() return.
I'm wondering if GetContainer() makes a copy itself. I was trying to use a pointer so that I wasn't creating copies of the nested container everywhere and everytime I wanted to access it (which will be frequently). But it looks I have to. Would this be right?