Can you typedef a specific object?

I'm getting tired of writing long lines of code just to represent one object (I have to go through get methods, cast the objects, etc) so is there a way that I can just convert a longer declaration of code into a variable name to save time and space?

e.g.
1
2
3
4
5
  int i = static_cast<Class*>(vector[0].get())->getInteger();
  //can ^^ just become something more like:
  Class object = static_cast<Class*>(vector[0].get());
  int i = object->getInteger();
  //or could I use typedef somehow? 

But I want to be sure that I'm passing the object by reference, not creating a copy of it. Is something like this even possible?
Last edited on
Topic archived. No new replies allowed.