Share via


basic_string::npos

An unsigned integral value initialized to –1 that indicates either "not found" or "all remaining characters" when a search function fails.

static const size_type npos = -1;

Remarks

When the return value is to be checked for the npos value, it might not work unless the return value is of type size_type and not either int or unsigned.

Example

See the example for find for an example of how to declare and use npos.

Requirements

Header: <string>

Namespace: std

See Also

Reference

basic_string Class