what does npos mean?

Started by
3 comments, last by hothead 19 years, 6 months ago
the book im using is showing me string::npos but it does not give a thorough explanation could someone give me a thorough explanation .
-----------------------------------Panic and anxiety Disorder HQ
Advertisement
it's an enumeration (for -1, as I recall). basically, it's shorthand for "this wasn't found anywhere in the string"
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
"The largest possible value of type size_type. That is, size_type(-1)", where size_type is "an unsigned integral type." Therefore, npos is the "rollover" value of that unsigned type. It serves to indicate an index that std::string cannot support, and many indexing methods return it to indicate "end of string".
In VC.NET, npos is defined as a "static const size_type npos = -1", which indicates a non-position. It is returned when a find function fails.

[edit] damn!
thanks a lot guys:).
-----------------------------------Panic and anxiety Disorder HQ

This topic is closed to new replies.

Advertisement