From d4742334cef2a5e9fcb9349ba7e8a14788614cf0 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Tue, 2 Jul 2024 23:34:20 +0900 Subject: [PATCH] fix: add detail::make_error_info_rec overload that converts basic_value to location --- include/toml11/fwd/error_info_fwd.hpp | 8 ++++++++ include/toml11/value.hpp | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/include/toml11/fwd/error_info_fwd.hpp b/include/toml11/fwd/error_info_fwd.hpp index 5d30b86..5b8600c 100644 --- a/include/toml11/fwd/error_info_fwd.hpp +++ b/include/toml11/fwd/error_info_fwd.hpp @@ -41,6 +41,10 @@ struct error_info std::string suffix_; // hint or something like that }; +// forward decl +template +class basic_value; + namespace detail { inline error_info make_error_info_rec(error_info e) @@ -53,6 +57,10 @@ inline error_info make_error_info_rec(error_info e, std::string s) return e; } +template +error_info make_error_info_rec(error_info e, + const basic_value& v, std::string msg, Ts&& ... tail); + template error_info make_error_info_rec(error_info e, source_location loc, std::string msg, Ts&& ... tail) diff --git a/include/toml11/value.hpp b/include/toml11/value.hpp index fe1720d..6139ad9 100644 --- a/include/toml11/value.hpp +++ b/include/toml11/value.hpp @@ -2026,12 +2026,16 @@ operator>=(const basic_value& lhs, const basic_value& rhs) } // error_info helper +namespace detail +{ template error_info make_error_info_rec(error_info e, const basic_value& v, std::string msg, Ts&& ... tail) { return make_error_info_rec(std::move(e), v.location(), std::move(msg), std::forward(tail)...); } +} // detail + template error_info make_error_info( std::string title, const basic_value& v, std::string msg, Ts&& ... tail)