1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
diff --git a/include/string_view b/include/string_view
index dd9239a..81d8c8a 100644
--- a/include/string_view
+++ b/include/string_view
@@ -216,6 +216,11 @@ namespace std {
# pragma GCC system_header
#endif
+#ifdef _LIBCPP_COMPILER_MSVC
+#pragma warning ( push )
+#pragma warning ( disable : 4455 )
+#endif
+
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
@@ -277,6 +282,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
+ _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+ basic_string_view(nullptr_t, size_t) = delete;
+
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT
: __data(__s), __size(__len)
@@ -319,7 +327,7 @@ public:
basic_string_view(const _CharT* __s)
: __data(__s), __size(_VSTD::__char_traits_length_checked<_Traits>(__s)) {}
-#if _LIBCPP_STD_VER > 20
+#if _LIBCPP_STD_VER > 17
basic_string_view(nullptr_t) = delete;
#endif
@@ -662,7 +670,8 @@ public:
(data(), size(), __s, __pos, traits_type::length(__s));
}
-#if _LIBCPP_STD_VER > 17
+//WARN: disabled std guards in order to allow using these options without switching to new std
+//#if _LIBCPP_STD_VER > 17
constexpr _LIBCPP_INLINE_VISIBILITY
bool starts_with(basic_string_view __s) const noexcept
{ return size() >= __s.size() && compare(0, __s.size(), __s) == 0; }
@@ -686,9 +695,9 @@ public:
constexpr _LIBCPP_INLINE_VISIBILITY
bool ends_with(const value_type* __s) const noexcept
{ return ends_with(basic_string_view(__s)); }
-#endif
+//#endif
-#if _LIBCPP_STD_VER > 20
+#if _LIBCPP_STD_VER >= 20
constexpr _LIBCPP_INLINE_VISIBILITY
bool contains(basic_string_view __sv) const noexcept
{ return find(__sv) != npos; }
@@ -952,6 +961,10 @@ inline namespace literals
#endif
_LIBCPP_END_NAMESPACE_STD
+#ifdef _LIBCPP_COMPILER_MSVC
+#pragma warning ( pop )
+#endif
+
_LIBCPP_POP_MACROS
#endif // _LIBCPP_STRING_VIEW
|