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-16
More in Developer tools and infrastructure
Rustrak is a self-hosted error tracker for collecting errors, logs, transactions, release health, and AI-agent traces through Sentry-compatible SDKs. Run it on your own hardware to monitor applications without moving to a hosted service.
Forked 2026-10-15Last synced 2026-10-16License: GPL-3.0Developer tools and infrastructureGitHub
WrapPin is an iOS 27+ tool for testing the location an iPhone reports to the system. Choose a fixed location or test walking and driving routes, then restore the real location.
Forked 2026-10-14Last synced 2026-10-16Custom license (see repository)Developer tools and infrastructureGitHub
Homelable helps self-hosted homelab users scan and diagram their infrastructure, document devices, and check whether services are online.
Forked 2026-10-14Last synced 2026-10-16License: MITDeveloper tools and infrastructureGitHub
Repowise indexes code, call graphs, Git history, tests, docs, and design decisions locally, helping developers and coding agents understand dependencies, find dead code, and decide what to fix.
Forked 2026-10-14Last synced 2026-10-16License: AGPL-3.0Developer tools and infrastructureGitHub