Cppmatch – Rust-Like Pattern Matching and Error Handling for C++
I've created cppmatch, a lightweight, header-only C++ library that brings Rust-inspired pattern matching and error handling to C++. It tries to imitate the functionality of the questionmark (?) operator in C++ by using a macro that uses the gcc extension https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html This allows to create exceptionless code with non-intrusive error-as-value that unlike Exceptions, makes it clear which kinds of error a function can generate and forces you to handle (or ignore) them. The ? operator translates to *expect* To handle the errors I…
In plain words
Cppmatch is a header-only C++ library that brings Rust-style pattern matching and error handling to C++. It enables developers to write exception-free code using error-as-value semantics, making error types explicit and forcing explicit handling. The library includes a macro-based operator similar to Rust's question mark operator and a match function for handling results and std::variant types, designed for developers seeking safer error handling patterns in C++.
written from the facts on this page · September 2026
From the sources
In the maker’s words, at launch
I've created cppmatch, a lightweight, header-only C++ library that brings Rust-inspired pattern matching and error handling to C++. It tries to imitate the functionality of the questionmark (?) operator in C++ by using a macro that uses the gcc extension https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html This allows to create exceptionless code with non-intrusive error-as-value that unlike Exceptions, makes it clear which kinds of error a function can generate and forces you to handle (or ignore) them. The ? operator translates to *expect* To handle the errors I introduce *match* which allows to easily visit the contents of the result or any std::variant (you can use it to imitate rust enums) You can view an example of this project used in a "real way" in compiler-explorer: Simplified error types to just be a string: https://compiler-explorer.com/z/6j3866E7W Multiple structs as error types: https://compiler-explorer.com/z/encbf5f43 Feel free to give feedback or contribute to the project!
Does the same job
all alternatives →- MIMatch(it): A C++17 pattern-matching library with lots of good stuffs2022 · github.com · ▲85
A lightweight single-header pattern-matching library for C++17 with macro-free APIs. Try it at https://godbolt.org/z/8YMr8Kz8j
- IBI built a small browser engine from scratch in C++Jan 2026 · github.com · ▲146
Hi HN! Korean high school senior here, about to start CS in college. I built a browser engine from scratch in C++ to understand how browsers work. First time using C++, 8 weeks of development, lots of debugging—but it works! Features: - HTML parsing with error correction - CSS cascade and inheritance - Block/inline layout engine - Async image loading + caching - Link navigation + history Hardest parts: - String parsing(html, css) - Rendering - Image Caching & Layout Reflowing What I learned (beyond code): - Systematic debugging is crucial - Ship with known bugs rather than chase…
- FAfcp – A significantly faster alternative to cp(1), written in Rust2021 · github.com · ▲88
- IMI'm making a dynamic language in Rust2022 · github.com · ▲184
An implementation of a dynamic programming language in Rust. Includes: Parser/Compiler, REPL, Virtual Machine, Bytecode Disassembler This started out as a learning project to teach myself Rust. It has grown into a decently substantial piece of software and I've learned quite a bit in the process! Some neat things: + A garbage collector that can store dynamically sized types without any double-indirection (i.e. I have my own Box implementation with manual alloc/dealloc) + The smart pointer used to reference GCed data is a thin pointer. The ptr metadata needed for DSTs is stored in…
- AIAnyone interested in a tool helps to explore C++ ASTsMay 2026 · uvic-aurora.github.io · ▲49
I built this software to help users who need to do static code analysis for C/C++ codebase. This can help you to explore the ASTs interactively. It can replace the Clang ast dump completely and also you can search the code/ASTs in a structual way. For example you can search a function which matches specific name or number of paremeters.
- IBI built a Cargo-like build tool for C/C++Apr 2026 · github.com · ▲177
I love C and C++, but setting up projects can sometimes be a pain. Every time I wanted to start something new I'd spend the first hour writing CMakeLists.txt, figuring out find_package, copying boilerplate from my last project, and googling why my library isn't linking. By the time the project was actually set up I'd lost all momentum. So, I built Craft - a lightweight build and workflow tool for C and C++. Instead of writing CMake, your project configuration goes in a simple craft.toml: [project] name = "my_app" version = "0.1.0" language = "c" c_standard = 99 [build] type = "executable"…
More dev tools this month
the category →



The first open-source price index for GPU compute
Dev tools · 10d ago · getcomputable.com

OpenTrailPaper is open-source bike computer firmware for the LilyGO T5S3 4.7" E-Paper PRO. It supports offline maps, GPX routes, FIT recording and Bluetooth sensors.
Dev tools · 2d ago · opentrailpaper.com

Open-source GTM skills for technical founders
Dev tools · 29d ago · gtmcofounder.com
Launched alongside, March 2025
the whole month →
Mimic Human Research & Save Findings in AI Knowledge Base
AI · 2025 · sider.ai




