Код: Выделить всё
bool Result = false;
auto CachedValue = ...; // std::variant
const auto& FirstValue = ...; // std::variant
if (auto ValIndex = CachedValue.index(); ValIndex == FirstValue.index())
{
switch (m_Relation)
{
case RELATION::EQ: Result = (CachedValue == FirstValue); break;
case RELATION::NE: Result = (CachedValue != FirstValue); break;
case RELATION::GT: Result = (CachedValue > FirstValue); break;
case RELATION::LE: Result = (CachedValue = FirstValue); break;
. . . . .
}
}
return Result;
Подробнее здесь: https://stackoverflow.com/questions/790 ... stdvariant