Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Constructor called while accessing vector

Name: Anonymous 2007-07-05 4:10 ID:gbn8N62F

I have a vector of a class of units:
std::vector<Unit> Units; //list of units

In Unit the constructor Unit::Unit() has a boolean value 'selected'. calling .select sets it to true

but for some reason when i go through each unit in the vector:

for(int i=0;i < Units.size(); i++){
    Units.at(i).select(driver,images);
}

it resets all values as if it got created again, with selected turning false. but
unit.select();

select does change inside the function, but not in the class. why would it do that?

Name: Anonymous 2007-07-05 4:11 ID:tFTOqSVZ

Sorry, we only discuss Satori/Lisp here. Take your C++ fagottry back to /comp/

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List