Replace cpptoml with toml11 v4.4.0 for TOML parsing#108
Merged
Conversation
cpptoml is unmaintained (archived) and supports only TOML v0.5.0. Switch to toml11 v4.4.0, which supports TOML v1.0.0 and provides error messages with source locations. The wrapper layer (find/find_or/load_if/get_array_of) keeps the existing input semantics: - A missing key falls back to the default value or raises input_error; a type mismatch always raises input_error (toml11's own find_or silently swallows type mismatches, so it is not used). - An integer value is still accepted where a float is expected (e.g. tau = 1), matching cpptoml's as<double>() behavior. - A scalar is still promoted to a single-element list (e.g. num_step = 100). Intentional behavior changes: - A missing [[evolution.simple]] / [[evolution.full]] now yields an empty update list instead of dereferencing a null pointer (UB). - Writing [observable.onesite] as a single table (instead of an array of tables) is now an error instead of being silently skipped. - Type errors now report the file name, line, and offending value. Also drop the boost demangle dependency from load_toml.cpp and update the dependency lists in README and the install docs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
yomichi
added a commit
that referenced
this pull request
Jul 11, 2026
Resolve conflicts between the toml11 migration (#108) and the C++17 modernization: - src/iTPS/CMakeLists.txt: use TOML11_INCLUDE_DIR and keep boost removed - src/iTPS/load_toml.cpp: adopt the toml11 wrappers from develop, rewritten with C++17 idioms (if constexpr, _v traits, structured bindings); drop the cpptoml-era bittype/demangle helpers Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces cpptoml with toml11 v4.4.0 as the TOML parser of the C++ solver. cpptoml is unmaintained (the repository is archived) and supports only TOML v0.5.0, while toml11 is actively maintained, supports TOML v1.0.0, and produces error messages with source locations.
Compatibility
The wrapper layer in
load_toml.cpp(find/find_or/load_if/get_array_of) is kept and reimplemented on top of toml11 so that the input semantics do not change:input_error; a type mismatch always raisesinput_error. toml11's owntoml::find_oris deliberately not used because it silently swallows type mismatches.tau = 1), matching cpptoml'sas<double>()behavior. This also applies elementwise to arrays.num_step = 100), and an emptysites = []/index = []still expands to all sites.Intentional behavior changes
A missing
[[evolution.simple]]/[[evolution.full]]now yields an empty update list instead of dereferencing a null pointer (undefined behavior).Writing
[observable.onesite]as a single table (instead of an array of tables) is now an error suggesting[[...]], instead of being silently skipped.Type errors now report the file name, line number, and the offending value:
Other changes
CPPTOML_ROOTis renamed toTOML11_ROOT.load_toml.cppno longer depends onboost::core::demangle.Test
make+ctest: all 23 tests pass (macOS, g++, MPI off).input_errorwith the new messages.🤖 Generated with Claude Code