What does std::vector& tokens; do?
I was writing a parser where my code had a structure like this (removed all the non-important parts for this question):
Passing a vector of pointers as an argument on the fly (C++)
guys. I am trying to pass as a function argument a vector of pointers to classes derived from a common base class. The catch is, I wish to do it in a single line, without declarating the vector first and then passing it by reference to the function. I came up with the following solution, which uses a wrapper class to encapsulate each vector element and pass the respective pointer to the vector constructor through an explicit conversion operator.