Implement LWG#2583: There is no way to supply an allocator for basic_string(str, pos)

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263036 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/string b/include/string
index a453779..6f5089c 100644
--- a/include/string
+++ b/include/string
@@ -98,8 +98,10 @@
     basic_string(const basic_string& str);
     basic_string(basic_string&& str)
         noexcept(is_nothrow_move_constructible<allocator_type>::value);
-    basic_string(const basic_string& str, size_type pos, size_type n = npos,
+    basic_string(const basic_string& str, size_type pos,                 // LWG#2583
                  const allocator_type& a = allocator_type());
+    basic_string(const basic_string& str, size_type pos, size_type n,    // LWG#2583
+                 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());
     basic_string(size_type n, value_type c, const allocator_type& a = allocator_type());
@@ -1397,7 +1399,9 @@
     basic_string(size_type __n, value_type __c);
     _LIBCPP_INLINE_VISIBILITY
     basic_string(size_type __n, value_type __c, const allocator_type& __a);
-    basic_string(const basic_string& __str, size_type __pos, size_type __n = npos,
+    basic_string(const basic_string& __str, size_type __pos, size_type __n,
+                 const allocator_type& __a = allocator_type());
+    basic_string(const basic_string& __str, size_type __pos,
                  const allocator_type& __a = allocator_type());
     template<class _InputIterator>
         _LIBCPP_INLINE_VISIBILITY
@@ -2223,6 +2227,20 @@
 }
 
 template <class _CharT, class _Traits, class _Allocator>
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
+                                                        const allocator_type& __a)
+    : __r_(__a)
+{
+    size_type __str_sz = __str.size();
+    if (__pos > __str_sz)
+        this->__throw_out_of_range();
+    __init(__str.data() + __pos, __str_sz - __pos);
+#if _LIBCPP_DEBUG_LEVEL >= 2
+    __get_db()->__insert_c(this);
+#endif
+}
+
+template <class _CharT, class _Traits, class _Allocator>
 template <class _InputIterator>
 typename enable_if
 <