So I have a scenario where there are classes inside classes so that the access to a particular variable or function:
stateMachine->data->poseEstimate->getData()
stateMachine->data->poseEstimate->setData()
Now this is totally legitimate but it looks convoluted and is hard to read. In the function i want to be able to do something like this:
typedef stateMachine->data->poseEstimate pose
pose->getData()
pose->setData()
which will make the code more readable. Obviously typedef wont work because it is for defining types. Is there an equal way that will allow me to do this?
In practice, I alias said object with a reference variable given a descriptive name relevant to the context it’s in:
If your compiler supports the
autokeyword, you can use anautoreference: