std::string::npos
is implementation defined index that is always out of bounds of any std::string
instance. Various std::string
functions return it or accept it to signal beyond the end of the string situation. It is usually of some unsigned integer type and its value is usually std::numeric_limits<std::string::size_type>::max ()
which is (thanks to the standard integer promotions) usually comparable to -1
.