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
- 385
- Category
- Developer tools and infrastructure
- Language
- C++
- License
- BSD-3-Clause
- Forked
- 2020-11-01
- Sync status
- In syncLast synced 2026-09-29
More in Developer tools and infrastructure
DBX is a lightweight, cross-platform database client for connecting to and managing over 100 database types. It offers desktop, Docker, and CLI access, plus AI assistance and an MCP Server for database workflows.
Forked 2026-09-29Last synced 2026-09-29License: Apache-2.0Developer tools and infrastructureGitHub
Escrcpy is a graphical desktop interface for scrcpy that mirrors and controls Android devices. It helps developers and testers manage connected devices, including wireless and multi-device workflows.
Forked 2026-09-29Last synced 2026-09-29License: Apache-2.0Developer tools and infrastructureGitHub
Lightpanda is a headless browser built from scratch for AI agents and automation. It aims to be lighter and faster than Chromium and works with Playwright and Puppeteer.
Forked 2026-09-28Last synced 2026-09-29License: AGPL-3.0Developer tools and infrastructureGitHub
A self-hosted open-source monitoring platform for servers, apps and infrastructure. It offers uptime monitoring, distributed checks, incident tracking and alerts.
Forked 2026-09-28Last synced 2026-09-29License: MITDeveloper tools and infrastructureGitHub