This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3 PATCH] Implement LWG 2758.


On 10/08/16 10:50 +0300, Ville Voutilainen wrote:
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 59f1c64..89e2100 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -1227,9 +1227,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       *  @param __n   The number of characters to append from the string_view.
       *  @return  Reference to this string.
       */
-      basic_string& append(__sv_type __sv,
+      template <typename _Tp,
+		enable_if_t<is_convertible_v<const _Tp&, __sv_type>,
+			    bool> = true>
+      basic_string& append(const _Tp& __svt,
			   size_type __pos, size_type __n = npos)

I would prefer the enable_if constraint to be on the return type, so
there is only one template parameter:

     template <typename _Tp>
       enable_if_t<is_convertible_v<const _Tp&, __sv_type>, basic_string&>
       append(const _Tp& __svt,
              size_type __pos, size_type __n = npos)

However these function templates appear to have a design problem, see
PR 77264.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]