What does the phrase std::string::npos mean in the following snippet of code?
found = str.find(str2);
if (found != std::string::npos)
std::
The document for string::npos says:
npos is a static member constant value with the greatest possible value for an element of type size_t.
As a return value it is usually used to indicate failure.
This constant is actually defined with a value of -1 (for any trait), which because size_t is an unsigned integral type, becomes the largest possible representable value for this type.