From efac3b36abb56e1e7fddf2a0985bf3dc10edb407 Mon Sep 17 00:00:00 2001 From: zel1b08a Date: Sat, 7 Dec 2024 20:56:08 +0700 Subject: [PATCH] Add char8_t feature guard. --- include/nlohmann/detail/conversions/to_json.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index f1c876584..c5f4ce834 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -435,7 +435,12 @@ inline void to_json(BasicJsonType& j, const T& t) template inline void to_json(BasicJsonType& j, const std_fs::path& p) { +#if defined __cpp_lib_char8_t + j = reinterpret_cast(p.u8string().data()); +#else j = p.u8string(); +#endif + } #endif