Namespaces
Variants

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

From cppreference.net
static constexpr size_type npos = size_type ( - 1 ) ;
(C++17부터)

이는 size_type 타입으로 표현 가능한 최대값과 동일한 특수 값입니다. 정확한 의미는 문맥에 따라 다르지만, 일반적으로 뷰 인덱스를 기대하는 함수들에 의해 뷰의 끝 표시자로 사용되거나, 뷰 인덱스를 반환하는 함수들에 의해 오류 표시자로 사용됩니다.

예제

#include <string_view>
constexpr bool
contains(std::string_view const what, std::string_view const where) noexcept
{
    return std::string_view::npos != where.find(what);
}
int main()
{
    using namespace std::literals;
    static_assert(contains("water", "in a bottle of water"));
    static_assert(!contains("wine", "in a bottle of champagne"));
    static_assert(""sv.npos == "haystack"sv.find("needle"));
}

참고 항목

constexpr size_type npos [static] 특수 값 size_type ( - 1 ) , 정확한 의미는 컨텍스트에 따라 다름