std::variant_npos

From cppreference.com
< cpp‎ | utility‎ | variant
 
 
Utilities library
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++17)

Elementary string conversions
(C++17)
(C++17)
 
 
Defined in header <variant>
inline constexpr std::size_t variant_npos = -1;
(since C++17)

This is a special value equal to the largest value representable by the type std::size_t, used as the return value of index() when valueless_by_exception() is true

See also

returns the zero-based index of the alternative held by the variant
(public member function)
checks if the variant is in the invalid state
(public member function)