I am not sure why this doesn't compile:
std::vector< const Obj& > myVector;
void foo(const Obj& obj)
{
myVector.push_back( obj );
}
Sorry, a bit of additional info on what I'm trying to achieve: I can't change the signature of foo without breaking an interface, but I just want to hang onto the Objects that get passed through foo. I do want to store pointers to them, but I'm confused about the syntax of how to do that.