Advertisement

Can I store references to objects in a std::vector

Started by December 04, 2000 10:47 PM
0 comments, last by gimp 24 years, 1 month ago
As the title says, I''d like to store references in a vector. I''m going to use this as a drawing list of what objects need to be drawn. The drawing routine will use the vector to call .draw() on each object reference it has to draw the scene. Do I have to use pointers here? Many thanks gimp
Chris Brodie
std::vector will not accept a reference as it''s template parameter. Under MSVC it''ll give you a bunch of "reference to reference is illegal" errors. Under Borland it''ll give you a bunch of "cannot define a pointer or reference to a reference" errors. So I guess you''re stuck with pointers.

This topic is closed to new replies.

Advertisement