Start of main content
Poor man's pattern matching, or how to write your own `std::visit` for AST.
Nobody likes writing a lot of
if else if code. In many languages, pattern matching exists to solve this problem.
Unfortunately, C++ only has it for
We'll discuss how to implement your own simple pattern matching solution using the example of working with AST nodes.