Patternia Documentation¶
A modern C++ pattern matching DSL
Patternia is a modern C++ pattern-matching DSL designed to make dispatch logic clear, expressive, and type-safe — without sacrificing performance or compilation efficiency.
Navigation¶
Start Here¶
- Getting Started - Minimal examples and core syntax
- Installation - How to integrate Patternia into your project
Concepts and Tutorials¶
- From Control Flow to Pattern Matching - Onramp for new users
- Pattern Matching in Other Languages - Mapping familiar ideas to Patternia
- Custom Predicate Guards - Guard design and composition
Worked Examples¶
- Policy Constraint Matching - Declarative rules and access control
- Geometric Constraint Matching - Numeric constraints as patterns
Reference¶
- API Documentation - Complete API reference for all patterns and functions
- Design Overview - Semantics and matching model
Project Information¶
- Releases - Version update history
- Benchmark Scripts - JSON compare and visualization tooling
System Requirements¶
- C++ Standard: C++17 or later
- Compilers: GCC ≥11, Clang ≥12, MSVC ≥2019
- Platforms: Linux, Windows, macOS
Benchmarking¶
- Run benchmark suite from project root:
.\build\bench\ptn_bench.exe --benchmark_filter="Variant" --benchmark_out=build/variant_all.json --benchmark_out_format=json
- Visualize one JSON across implementations:
py -3 scripts/bench_single_report.py --input build/variant_all.json --include "Variant" --outdir build/bench/single --prefix variant_single
Make logical structure explicit, make C++ code more elegant