Hey guys.
These functions are not working together correctly because of the true/false statements. Can someone please show me how I can fix the empty() function to work simultaneously with my other function provided? :S
My getSmallest() function will not return the value due to the empty() function..
bool set::empty() const
{
for (int i = 0; i <= positions.size(); i++)
{
if (i = -1)
{
return true;
}
return false;
}
}
int set::getSmallest() const
{
for (int i = 0; i < DEFAULTSIZE; i++)
{
if (setlist.at(i) == 1)
{
positions.push_back(i);
}
}
if ( !positions.empty() )
{
return *( min_element( positions.begin(), positions.end() ) );
}
return -1;
}
Thanks :)