variant
A header-only C++11/C++14 alternative to boost::variant. It provides a type-safe way to hold one of several types, such as a result or an error.
Share on XLicense: BSD-3-Clause
Overview
Mapbox Variant is a header-only alternative to boost::variant for C++11 and C++14. It gives a type-safe way to hold one of several types, for example an API response that is either a result or an error. It offers pattern matching with lambdas, visitors, and a recursive wrapper for tree-like types such as JSON. It has no dependencies.
Key features
- Type-safe variant for sum types and discriminated unions
- match() member takes lambdas and checks all types are handled
- apply_visitor and get() for visiting or unwrapping values
- recursive_wrapper supports recursive types such as JSON trees
Best for
C++11 or C++14 projects that want variant types without depending on Boost. It aims for a drop-in API with boost::variant but implements only the features actually needed.
- Upstream
- mapbox/variant
- Fork on GitHub
- Guo-astro/variant
- Upstream stars
- 384
- Category
- Developer tools and infrastructure
- Language
- C++
- License
- BSD-3-Clause
- Forked
- 2020-11-01
- Sync status
- In syncLast synced 2026-10-10
More in Developer tools and infrastructure
Creates full-stack project scaffolds from compatible stack parts, reducing setup and integration work. Use the CLI, browser builder, or MCP server to generate a project.
Forked 2026-10-09Last synced 2026-10-10License: MITDeveloper tools and infrastructureGitHub
A Python SDK for adding local face detection, landmark extraction, and face comparison to applications on Windows and Linux, without sending images off-device.
Forked 2026-10-09Last synced 2026-10-10No license declaredDeveloper tools and infrastructureGitHub
Whole-disk file search for macOS that finds files by name quickly, handles typos, and searches indexed file contents. Best for local desktop search from the CLI or Rust crate.
Forked 2026-10-08Last synced 2026-10-10License: MITDeveloper tools and infrastructureGitHub
REA helps reverse engineers inspect apps, binaries, and runtime behavior with agent workflows. It is used to understand how a feature works, find evidence, and build a similar capability in a project.
Forked 2026-10-08Last synced 2026-10-10License: MITDeveloper tools and infrastructureGitHub