This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3 PATCH] Implement LWG 2758.
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Paolo Carlini <paolo dot carlini at oracle dot com>
- Date: Tue, 16 Aug 2016 12:52:34 +0100
- Subject: Re: [v3 PATCH] Implement LWG 2758.
- Authentication-results: sourceware.org; auth=none
- References: <CAFk2RUZ1-wY57+4DUBQPfXkx46SjNSgFMKDqf-Syph3yF-qMGQ@mail.gmail.com>
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.