[libcxx-commits] [libcxx] [libc++][NFC] Simplify string a bit (PR #127135)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Feb 16 01:52:46 PST 2025
================
@@ -3539,11 +3525,12 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
_LIBCPP_ASSERT_INTERNAL(__is_long(), "Trying to shrink small string");
// We're a long string and we're shrinking into the small buffer.
+ auto __ptr = __get_long_pointer();
+ auto __size = __get_long_size();
+ auto __cap = __get_long_cap();
----------------
philnik777 wrote:
I don't think this makes the code easier to understand. You have much more code in between the place the variables are used and where they are declared. I know what the functions do, but I don't know what the variables defined in a function actually do.
https://github.com/llvm/llvm-project/pull/127135
More information about the libcxx-commits
mailing list