close
The Wayback Machine - https://web.archive.org/web/20190718114814/https://zh.cppreference.com/w/cpp/string/basic_string_view/npos

std::basic_string_view<CharT,Traits>::npos

来自cppreference.com
 
 
 
 
static constexpr size_type npos = size_type(-1);
(C++17 起)

这是等于 size_type 类型所能表示最大值的特殊值。准确的含义依赖于语境,不过通常期待视图下标的函数以之为视图尾指示器,而返回视图下标的函数以之为错误指示器。