>>576
Rustの if let でのenumパターンマッチングは、
まずRustのenumを理解する必要があるけど、例えば、

enum State {
StateA(i32),
StateB(i32),
StateC(i32, f32),
}

if let State::StateA(i) = x {
println!("StateA: {i}");
}

これをc++で書こうとするとこうなるのかな。

struct StateA { int i; };
struct StateB { int i; };
struct StateC { int i; float f; };
typedef std::variant<StateA, StateB, StateC> State;

if (std::holds_alternative<StateA>(x)) {
StateA& a = std::get<StateA>(x);
std::cout << "StateA: " << a.i << "\n";
}

この両者がたぶん同じ。
if let構文のおかげでRustは可読性が増していると思う。