Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted last week in Issaquah
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286858 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/string b/include/string
index 347cb68..840fd00 100644
--- a/include/string
+++ b/include/string
@@ -102,6 +102,8 @@
const allocator_type& a = allocator_type());
basic_string(const basic_string& str, size_type pos, size_type n,
const Allocator& a = Allocator());
+ template<class T>
+ basic_string(const T& t, size_type pos, size_type n, const Allocator& a = Allocator()); // C++17
explicit basic_string(const basic_string_view<charT, traits> sv, const Allocator& a = Allocator());
basic_string(const value_type* s, const allocator_type& a = allocator_type());
basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type());
@@ -789,6 +791,10 @@
_LIBCPP_INLINE_VISIBILITY
basic_string(const basic_string& __str, size_type __pos,
const allocator_type& __a = allocator_type());
+ template<class _Tp>
+ basic_string(const _Tp& __t, size_type __pos, size_type __n,
+ const allocator_type& __a = allocator_type(),
+ typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type* = 0);
_LIBCPP_INLINE_VISIBILITY explicit
basic_string(__self_view __sv);
_LIBCPP_INLINE_VISIBILITY
@@ -1717,6 +1723,20 @@
}
template <class _CharT, class _Traits, class _Allocator>
+template <class _Tp>
+basic_string<_CharT, _Traits, _Allocator>::basic_string(
+ const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a,
+ typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type *)
+ : __r_(__a)
+{
+ __self_view __sv = __self_view(__t).substr(__pos, __n);
+ __init(__sv.data(), __sv.size());
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv)
{