aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2016-11-15 19:32:52 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2016-11-15 19:32:52 +0000
commit3663671a13e12efe283d1b04df5416cedb796e86 (patch)
treef4ac9f6d27c55a5882e69c64c4732520c0e1f12f /libstdc++-v3
parent6ae2ae3b84615e5e4504a1592af6a8d5579f17ca (diff)
downloadgcc-3663671a13e12efe283d1b04df5416cedb796e86.zip
gcc-3663671a13e12efe283d1b04df5416cedb796e86.tar.gz
gcc-3663671a13e12efe283d1b04df5416cedb796e86.tar.bz2
Use existing helper for new std::string constructor
* include/bits/basic_string.h: Reuse _If_sv alias template for new constructor. From-SVN: r242453
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog3
-rw-r--r--libstdc++-v3/include/bits/basic_string.h16
2 files changed, 10 insertions, 9 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 6bf1ecb..4bba6a4 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,8 @@
2016-11-15 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/basic_string.h: Reuse _If_sv alias template for new
+ constructor.
+
* doc/xml/manual/intro.xml: Document LWG 2770 status. Remove entries
for 2742 and 2748.
* doc/html/*: Regenerate.
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 943e88d..9af7bfb 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -585,6 +585,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
{ _M_construct(__beg, __end); }
#if __cplusplus > 201402L
+ template<typename _Tp, typename _Res>
+ using _If_sv = enable_if_t<
+ __and_<is_convertible<const _Tp&, __sv_type>,
+ __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
+ _Res>;
+
/**
* @brief Construct string from a substring of a string_view.
* @param __t Source string view.
@@ -592,9 +598,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
* @param __n The number of characters to copy from __t.
* @param __a Allocator to use.
*/
- template<typename _Tp, typename =
- _Require<is_convertible<_Tp, __sv_type>,
- __not_<is_convertible<const _Tp&, const _CharT*>>>>
+ template<typename _Tp, typename = _If_sv<_Tp, void>>
basic_string(const _Tp& __t, size_type __pos, size_type __n,
const _Alloc& __a = _Alloc())
: basic_string(__sv_type(__t).substr(__pos, __n), __a) { }
@@ -1252,12 +1256,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
append(__sv_type __sv)
{ return this->append(__sv.data(), __sv.size()); }
- template<typename _Tp, typename _Res>
- using _If_sv = enable_if_t<
- __and_<is_convertible<const _Tp&, __sv_type>,
- __not_<is_convertible<const _Tp&, const _CharT*>>>::value,
- _Res>;
-
/**
* @brief Append a range of characters from a string_view.
* @param __sv The string_view to be appended from.