Sign in to follow this  
hothead

what does npos mean?

Recommended Posts

hothead    767
the book im using is showing me string::npos but it does not give a thorough explanation could someone give me a thorough explanation .

Share this post


Link to post
Share on other sites
Oluseyi    2103
"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".

Share this post


Link to post
Share on other sites
jflanglois    1020
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this