[libcxx-commits] [libcxx] [libc++][NFC] Simplify the implementation of string and string_views operator== (PR #117184)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 10 12:11:21 PST 2024
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 5a0d73b1da880e475e8187e8962b574174bdd0a9 ecdc97b40d17c12eac96b368494a57d4a6572c3a --extensions -- libcxx/include/string libcxx/include/string_view
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/string b/libcxx/include/string
index c7a87053d4..e96237488b 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -3858,15 +3858,15 @@ operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT*
return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
}
-#if _LIBCPP_STD_VER <= 17
+# if _LIBCPP_STD_VER <= 17
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_HIDE_FROM_ABI bool
operator==(const _CharT* __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT {
return __rhs == __lhs;
}
-#endif // _LIBCPP_STD_VER <= 17
+# endif // _LIBCPP_STD_VER <= 17
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index 8d817bb5c2..a62d75a008 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -733,7 +733,7 @@ operator==(basic_string_view<_CharT, _Traits> __lhs,
return __lhs.compare(__rhs) == 0;
}
-#if _LIBCPP_STD_VER >= 20
+# if _LIBCPP_STD_VER >= 20
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(basic_string_view<_CharT, _Traits> __lhs,
``````````
</details>
https://github.com/llvm/llvm-project/pull/117184
More information about the libcxx-commits
mailing list