std::bad_variant_access
From cppreference.com
Defined in header <variant>
|
||
class bad_variant_access : public std::exception |
(since C++17) | |
std::bad_variant_access
is the type of the exception thrown in the following situations:
- std::get(std::variant) called with an index or type that does not match the currently active alternative.
-
std::visit
called to visit avariant
that isvalueless_by_exception
.
|
(since C++26) |
All member functions of std::bad_variant_access are constexpr: it is possible to create and use std::bad_variant_access objects in the evaluation of a constant expression.However, |
(since C++26) |
Contents |