Search code examples
c++setstdset

set list in c++


I've created a set list in c++ and fullfilled with elements

std::set<Unit*> myUnits; 

for(std::set<Unit*>::iterator i = myUnits.begin(); i != myUnits.end(); i++) {   
    if() {}
}

So i want in if to check every element of the setlist, what have to put in if?


Solution

  • Unit* pUnit = *i; will give you a pointer to a Unit object. By the way, the correct term for the container is "set", not "setlist".