Defined in header <variant> | ||
|---|---|---|
template <class... Types> constexpr bool operator==(const std::variant<Types...>& v, const std::variant<Types...>& w); | (1) | (since C++17) |
template <class... Types> constexpr bool operator!=(const std::variant<Types...>& v, const std::variant<Types...>& w); | (2) | (since C++17) |
template <class... Types> constexpr bool operator<(const std::variant<Types...>& v, const std::variant<Types...>& w); | (3) | (since C++17) |
template <class... Types> constexpr bool operator>(const std::variant<Types...>& v, const std::variant<Types...>& w); | (4) | (since C++17) |
template <class... Types> constexpr bool operator<=(const std::variant<Types...>& v, const std::variant<Types...>& w); | (5) | (since C++17) |
template <class... Types> constexpr bool operator>=(const std::variant<Types...>& v, const std::variant<Types...>& w); | (6) | (since C++17) |
v.index() != w.index(), returns false; v.valueless_by_exception(), returns true; std::get<v.index()>(v) == std::get<v.index()>(w). The behavior is undefined if std::get<i>(v) == std::get<i>(w) is not a valid expression returning a type convertible to bool, for any i.v.index() != w.index(), returns true; v.valueless_by_exception(), returns false; std::get<v.index()>(v) != std::get<v.index()>(w). The behavior is undefined if std::get<i>(v) != std::get<i>(w) is not a valid expression returning a type convertible to bool, for any i.w.valueless_by_exception(), returns false; v.valueless_by_exception(), returns true; v.index() < w.index(), returns true; v.index() > w.index(), returns false; std::get<v.index()>(v) < std::get<v.index()>(w). The behavior is undefined if std::get<i>(v) < std::get<i>(w) is not a valid expression returning a type convertible to bool, for any i.v.valueless_by_exception(), returns false; w.valueless_by_exception(), returns true; v.index() > w.index(), returns true; v.index() < w.index(), returns false; std::get<v.index()>(v) > std::get<v.index()>(w). The behavior is undefined if std::get<i>(v) > std::get<i>(w) is not a valid expression returning a type convertible to bool, for any i.v.valueless_by_exception(), returns true; w.valueless_by_exception(), returns false; v.index() < w.index(), returns true; v.index() > w.index(), returns false; std::get<v.index()>(v) <= std::get<v.index()>(w). The behavior is undefined if std::get<i>(v) <= std::get<i>(w) is not a valid expression returning a type convertible to bool, for any i.w.valueless_by_exception(), returns true; v.valueless_by_exception(), returns false; v.index() > w.index(), returns true; v.index() < w.index(), returns false; std::get<v.index()>(v) >= std::get<v.index()>(w). The behavior is undefined if std::get<i>(v) >= std::get<i>(w) is not a valid expression returning a type convertible to bool, for any i.| v,w | - | variants to compare |
The boolean result of the comparison as described above.
|
(C++17) | compares optional objects (function template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/variant/operator_cmp