pattern matching in c++
i had to write nested switch cases and i hated it so i decided to roll my own primitive pattern matching in c++ ocaml can be beautiful sometimes (unfortunately the same cannot be said for c++): let rec last2 l = match l with | [] | [_] -> None | [x; y] -> Some (x, y) | _ :: t -> last2 t for my use case it’d be smth like let get color shape = match (color, shape) with | ("orange", "circle") -> "basketball" | ("orange", _) -> "orange chicken" | (_, "circle") -> "jupiter" | _ -> "love" ah i forgor abt python: ...