[PATCH] D21459: Implement http://wg21.link/P0254R1: "Integrating std::string_view and std::string"

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 20 17:45:32 PDT 2016


EricWF added a comment.

Why did you remove the `_VSTD` qualified on most of the `__str_find` function calls? I think that should be a qualified call because a UDT traits type can hijack overload resolution.
(Although __str_find* is a reserved name).

I'm happy with the changes to `<string>`. Moving onto `<string_view>`


================
Comment at: include/string:797
@@ +796,3 @@
+    basic_string(__self_view __sv);
+	_LIBCPP_INLINE_VISIBILITY
+    basic_string(__self_view __sv, const allocator_type& __a);
----------------
indent.

================
Comment at: include/string:997
@@ -1589,1 +996,3 @@
+    basic_string& insert(size_type __pos1, __self_view __sv) { return insert(__pos1, __sv.data(), __sv.size()); }
+    basic_string& insert(size_type __pos1, __self_view __sv, size_type __pos2, size_type __n=npos);
     basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n=npos);
----------------
Missing _LIBCPP_INLINE_VISIBILITY

================
Comment at: include/string:1038
@@ -1626,2 +1037,3 @@
     basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
+    basic_string& replace(size_type __pos1, size_type __n1, __self_view __sv, size_type __pos2, size_type __n2=npos);
     basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2);
----------------
Missing _LIBCPP_INLINE_VISIBILITY

================
Comment at: include/string:1157
@@ -1726,2 +1156,3 @@
     int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos) const;
+    int compare(size_type __pos1, size_type __n1, __self_view __sv, size_type __pos2, size_type __n2=npos) const;
     int compare(const value_type* __s) const _NOEXCEPT;
----------------
Missing _LIBCPP_INLINE_VISIBILITY

================
Comment at: include/string:2374
@@ -2898,1 +2373,3 @@
 basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, __self_view __sv,
+                                                  size_type __pos2, size_type __n)
----------------
Missing _LIBCPP_INLINE_VISIBILITY

================
Comment at: include/string:2384
@@ -2899,1 +2383,3 @@
+template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>&
 basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)
----------------
Missing _LIBCPP_INLINE_VISIBILITY

================
Comment at: include/string:2940
@@ -3442,3 +2939,3 @@
     _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr");
-    return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+    return __str_find<value_type, size_type, traits_type, npos>
         (data(), size(), __s, __pos, __n);
----------------
This call should be qualified.

================
Comment at: include/string:2950
@@ -3452,3 +2949,3 @@
 {
-    return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+    return __str_find<value_type, size_type, traits_type, npos>
         (data(), size(), __str.data(), __pos, __str.size());
----------------
This call should be qualified.

================
Comment at: include/string:2960
@@ +2959,3 @@
+{
+    return __str_find<value_type, size_type, traits_type, npos>
+        (data(), size(), __sv.data(), __pos, __sv.size());
----------------
This call should be qualified.

================
Comment at: include/string:2980
@@ -3472,3 +2979,3 @@
 {
-    return _VSTD::__str_find<value_type, size_type, traits_type, npos>
+    return __str_find<value_type, size_type, traits_type, npos>
         (data(), size(), __c, __pos);
----------------
This call should be qualified.

================
Comment at: include/string:2993
@@ -3485,3 +2992,3 @@
     _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr");
-    return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+    return __str_rfind<value_type, size_type, traits_type, npos>
         (data(), size(), __s, __pos, __n);
----------------
This call should be qualified.

================
Comment at: include/string:3003
@@ -3495,3 +3002,3 @@
 {
-    return _VSTD::__str_rfind<value_type, size_type, traits_type, npos>
+    return __str_rfind<value_type, size_type, traits_type, npos>
         (data(), size(), __str.data(), __pos, __str.size());
----------------
This call should be qualified.


https://reviews.llvm.org/D21459





More information about the cfe-commits mailing list