[libc++] Fix constraints for string_view's iterator/sentinel constructor
The `string_view` constructor taking an iterator/sentinel uses concepts
instead of type traits like the Standard states. Using `same_as` instead
of `is_same_v` should be harmless. Prefer `std::is_same_v` instead which is
cheaper to compile. Replace `convertible_to` with `is_convertible_v` as
well.
This observation came up while working on
https://reviews.llvm.org/D113161
Differential Revision: https://reviews.llvm.org/D114561
GitOrigin-RevId: 68e7e76a9be022427e572101cde4e00203c9af46
diff --git a/include/string_view b/include/string_view
index 0ad7dcc..373b394 100644
--- a/include/string_view
+++ b/include/string_view
@@ -191,8 +191,6 @@
*/
-#include <__concepts/convertible_to.h>
-#include <__concepts/same_as.h>
#include <__config>
#include <__debug>
#include <__ranges/enable_borrowed_range.h>
@@ -282,7 +280,7 @@
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_RANGES)
template <contiguous_iterator _It, sized_sentinel_for<_It> _End>
- requires (same_as<iter_value_t<_It>, _CharT> && !convertible_to<_End, size_type>)
+ requires (is_same_v<iter_value_t<_It>, _CharT> && !is_convertible_v<_End, size_type>)
constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end)
: __data(_VSTD::to_address(__begin)), __size(__end - __begin)
{