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

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 26 06:06:27 PST 2025


================
@@ -2763,16 +2772,16 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
 template <class _CharT, class _Traits, class _Allocator>
 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
 basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c) {
-  pointer __p;
   size_type __old_size = size();
   if (__old_size == 0)
     __annotate_increase(1);
+  pointer __p;
   if (__is_long()) {
-    __p = __get_long_pointer();
     __set_long_size(1);
+    __p = __get_long_pointer();
----------------
philnik777 wrote:

Let's keep the same order here. It looks like you've used the original order in other places as well.

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


More information about the libcxx-commits mailing list