From 2422dfe4fd48a668b94d01afb72a5bcbe0b28df8 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Mon, 9 Oct 2023 11:02:04 +0800 Subject: [PATCH] resize compatible with gcc4.x (#418) --- include/cinatra/string_resize.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/cinatra/string_resize.hpp b/include/cinatra/string_resize.hpp index 1913087a..f63c7406 100644 --- a/include/cinatra/string_resize.hpp +++ b/include/cinatra/string_resize.hpp @@ -24,15 +24,24 @@ class string_thief { friend void string_set_length_hacker(std::string& self, std::size_t sz) { #if defined(_MSVC_STL_VERSION) (self.*func_ptr)._Myval2._Mysize = sz; +#else +#if (_GLIBCXX_USE_CXX11_ABI == 0) && defined(__GLIBCXX__) + (self.*func_ptr)()->_M_set_length_and_sharable(sz); #else (self.*func_ptr)(sz); +#endif #endif } }; #if defined(__GLIBCXX__) // libstdc++ +#if (_GLIBCXX_USE_CXX11_ABI == 0) +template class string_thief; +#else template class string_thief; +#endif #elif defined(_LIBCPP_VERSION) template class string_thief;