From 942eadef5c7cf0211e1f48806b9ed6dcc362af14 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Thu, 30 Jan 2025 00:35:36 +0900 Subject: [PATCH] fix: guard access check funcs by macro --- include/toml11/value.hpp | 2 ++ tests/test_accessed.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/toml11/value.hpp b/include/toml11/value.hpp index 9d54648..7053f35 100644 --- a/include/toml11/value.hpp +++ b/include/toml11/value.hpp @@ -2042,7 +2042,9 @@ class basic_value comment_type const& comments() const noexcept {return this->comments_;} comment_type& comments() noexcept {return this->comments_;} +#ifdef TOML11_ENABLE_ACCESS_CHECK bool accessed() const {return this->accessed_.load();} +#endif private: diff --git a/tests/test_accessed.cpp b/tests/test_accessed.cpp index 68d48ee..c983e43 100644 --- a/tests/test_accessed.cpp +++ b/tests/test_accessed.cpp @@ -3,6 +3,8 @@ #include +#ifdef TOML11_ENABLE_ACCESS_CHECK + TEST_CASE("testing toml::parse(file)") { using namespace toml::literals::toml_literals; @@ -70,3 +72,5 @@ role = "backend" CHECK_UNARY_FALSE(u.at("database").at("temp_targets").at("cpu" ).accessed()); CHECK_UNARY_FALSE(u.at("database").at("temp_targets").at("case").accessed()); } + +#endif // TOML11_ENABLE_ACCESS_CHECK