string::npos = -1?

Discussion in 'C++' started by maceron, Sep 2, 2010.

  1. maceron

    maceron New Member

    Joined:
    Sep 2, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Just a quick question, if string::npos represents the largest possible value for a string object, how can this value be -1 if it's an unsigned integer?
    I know this value will change for different compilers, as string::npos on my compiler is set to 4,294,967,295 which makes sense but I don't understand how -1 can represent the largest value.

    Thanks in advance
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice