A feature-rich, header-only C++11/14/17/20 library for parsing and serializing TOML configuration files with full spec compliance.
toml11 is a header-only C++ library for parsing, manipulating, and serializing TOML (Tom's Obvious, Minimal Language) configuration files. It solves the problem of reading and writing TOML files in C++ projects with full compliance to the TOML specification, support for modern C++ standards, and features like comment preservation and clear error reporting.
C++ developers working on applications that require configuration management, such as game engines, desktop software, servers, or tools that use TOML files for settings.
Developers choose toml11 for its strict adherence to the TOML spec, excellent error messages, header-only simplicity, and extensive features like comment retention and customizable types, making it a robust alternative to other TOML libraries in the C++ ecosystem.
TOML for Modern C++
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports TOML v1.0.0 fully and integrates upcoming v1.1.0 features, passing all standard test cases for reliability, as stated in the README.
Provides detailed, colorizable error messages with exact locations and hints, demonstrated in the README with examples like bad integer parsing.
Parses and retains comments linked to values, enabling round-trip editing without losing metadata, as shown in the code snippet with `value.comments()`.
Easily converts TOML values to STL containers and user-defined types using macros, illustrated in examples with complex structures like tuples and custom structs.
Version 4 introduces several breaking changes from v3, requiring code updates for advanced users, as admitted in the README under 'Changes from v3'.
Precompiling the library requires specifying CMAKE_CXX_STANDARD and managing options like TOML11_PRECOMPILE, adding complexity compared to simple header-only inclusion.
While comprehensive, the documentation is extensive and relies on external examples for complex use cases, which might slow down quick onboarding.