[libcxx-commits] [libcxx] [libc++][NFC] Simplify string a bit (PR #127135)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 19 06:42:38 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 think I'd be fine with moving the defintions here if we make them `const`. That way it's obvious they're not changed between the definition and the use.

https://github.com/llvm/llvm-project/pull/127135


More information about the libcxx-commits mailing list