[libcxx-commits] [libcxx] [libc++][string] P3044R2: sub-`string_view` from `string` (PR #147095)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 6 08:58:37 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions ,cpp -- libcxx/test/std/strings/basic.string/string.ops/string_substr/subview.pass.cpp libcxx/test/std/strings/string.view/string.view.ops/subview.pass.cpp libcxx/include/string libcxx/include/string_view libcxx/include/version libcxx/test/std/language.support/support.limits/support.limits.general/string.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/string_view.version.compile.pass.cpp libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 7b093813b..98be41e19 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -473,7 +473,8 @@ public:
     // valid view. In particular, `size()` is known to be smaller than `numeric_limits<difference_type>::max()`, so the
     // new size is also smaller. See also https://github.com/llvm/llvm-project/issues/91634.
     return __pos > size() ? (__throw_out_of_range("string_view::subview"), basic_string_view())
-                          : basic_string_view(__assume_valid(), data() + __pos, std::min(__n, size() - __pos));  }
+                          : basic_string_view(__assume_valid(), data() + __pos, std::min(__n, size() - __pos));
+  }
 #  endif
 
   _LIBCPP_CONSTEXPR_SINCE_CXX14 int compare(basic_string_view __sv) const _NOEXCEPT {

``````````

</details>


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


More information about the libcxx-commits mailing list