Однако проблема возникает, когда я попробуйте сравнить два std::variant, и компилятор отправит следующую ошибку:
Код: Выделить всё
call to object of class type 'std::not_equal_to': no matching call operator foundКод: Выделить всё
#include
#include
namespace Q
{
struct ErrorType {};
} using namespace Q;
bool operator!= (ErrorType a, ErrorType b) { return false; }
signed main()
{
std::variant a, b;
a = 1.0, b = 2.0;
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78743388/weird-behavior-dealing-with-c-stdvariant-comparison-and-operator-functions[/url]
Мобильная версия