[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
    
    
  
================
@@ -2701,19 +2707,24 @@ template <class _CharT, class _Traits, class _Allocator>
 template <bool __is_short>
 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NOINLINE basic_string<_CharT, _Traits, _Allocator>&
 basic_string<_CharT, _Traits, _Allocator>::__assign_no_alias(const value_type* __s, size_type __n) {
-  size_type __cap = __is_short ? static_cast<size_type>(__min_cap) : __get_long_cap();
+  const auto __cap = __is_short ? static_cast<size_type>(__min_cap) : __get_long_cap();
+  const auto __sz  = __is_short ? __get_short_size() : __get_long_size();
----------------
philnik777 wrote:
```suggestion
  const auto __size  = __is_short ? __get_short_size() : __get_long_size();
```
Same throughout where you renamed variables anyways.
https://github.com/llvm/llvm-project/pull/127135
    
    
More information about the libcxx-commits
mailing list