Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualServant of the Lord

Posted 15 December 2012 - 05:20 PM

A possible solution would be to cast your unsigned value (the size_t result from vector<>.size()) to a signed value.
if(myInt < (int)vector.size())

Side-effects: if your size_t ever reaches higher than 31^2 (about two billion), your value will likely loop around to -31^2 (around negative two billion).

 

if(selectedOption_ >= int(optionsList_.size()))
{
	
}
else if(selectedOption_ < firstSelectableOption_)
{
	
}

#1Servant of the Lord

Posted 15 December 2012 - 05:16 PM

A possible solution would be to cast your unsigned value (the size_t result from vector<>.size()) to a signed value.
if(myInt < (int)vector.size())

Side-effects: if your size_t ever reaches higher than 31^2 (about two billion), your value will likely loop around to -31^2 (around negative two billion).

PARTNERS