From 461b4c14a112dba59d510cd66b70dc78fe06a0c7 Mon Sep 17 00:00:00 2001 From: Joseph C Wang Date: Sun, 1 Dec 2024 18:32:17 +0800 Subject: [PATCH 1/2] fix string cast for c++20 --- src/io.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/io.cpp b/src/io.cpp index 38f907e..320a4d4 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -70,7 +70,12 @@ void register_io(py::module& m) { .def(py::init<>()) .def(py::init()) .def("__str__", - (std::string(std::stringstream::*)() const)&std::stringstream::str); +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + (std::string (std::stringstream::*)() const &) +#else + (std::string (std::stringstream::*)() const) +#endif + & std::stringstream::str); py::class_(m, "Reader") // clang-format off From 98d87d36bcf25fe8c54cd2106b6511c7c587bfd7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 10:36:22 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/io.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/io.cpp b/src/io.cpp index 320a4d4..5da8fb9 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -71,11 +71,11 @@ void register_io(py::module& m) { .def(py::init()) .def("__str__", #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI - (std::string (std::stringstream::*)() const &) + (std::string(std::stringstream::*)() const&) #else - (std::string (std::stringstream::*)() const) + (std::string(std::stringstream::*)() const) #endif - & std::stringstream::str); + &std::stringstream::str); py::class_(m, "Reader") // clang-format off