Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualJTippetts

Posted 15 December 2012 - 04:32 PM

std::vector::size is an unsigned type, per the docs. Subtracting 1 from an unsigned 0 value doesn't give you a negative value, it gives you the maximum value the unsigned type can hold. Edit: Furthermore if the negative integer you are trying to compare gets implicitly cast to unsigned int, then it's no longer negative, just very large positive.

#1JTippetts

Posted 15 December 2012 - 04:29 PM

std::vector::size is an unsigned type, per the docs. Subtracting 1 from an unsigned 0 value doesn't give you a negative value, it gives you the maximum value the unsigned type can hold.

PARTNERS