scantraXx- -9 Light Poster

Hey guys.

I'm having trouble getting the largest/smallest value of an element in a set I created from my class. It has to return the largest/smallest element of specific elements that are set to true in my <bool> vector.

Example:

int set::getLargest() const
{
    if ( !setlist.empty() )
    {
    	return *( max_element( setlist.begin(), setlist.end() ) );
    }
    return -1;
}

I want something like this:

int set::getLargest() const
{
    for (int i = 0; i < setlist.size(); i++)
   {   
        if ( !setlist.empty() && setlist.at(i) == true )
        {
    	    return *( max_element(  ) );
        }
        return -1;
   }
}

I want it to return the max element out of all the elements that setlist.at(i) == true.

I tried storing all the true elements in a seperate vector <int> but all the elements will keep piling up etc..

Any help or suggestions would be appreciated.
Thanks :)