Implement deduction guide for basic_string as described in P0433
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@324569 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/string b/include/string
index f89ef57..e8ec709 100644
--- a/include/string
+++ b/include/string
@@ -311,6 +311,13 @@
bool __invariants() const;
};
+template<class InputIterator,
+ class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
+basic_string(InputIterator, InputIterator, Allocator = Allocator())
+ -> basic_string<typename iterator_traits<InputIterator>::value_type,
+ char_traits<typename iterator_traits<InputIterator>::value_type>,
+ Allocator>; // C++17
+
template<class charT, class traits, class Allocator>
basic_string<charT, traits, Allocator>
operator+(const basic_string<charT, traits, Allocator>& lhs,
@@ -1485,6 +1492,18 @@
friend basic_string operator+<>(const basic_string&, value_type);
};
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template<class _InputIterator,
+ class _CharT = typename iterator_traits<_InputIterator>::value_type,
+ class _Allocator = allocator<_CharT>,
+ class = typename enable_if<__is_input_iterator<_InputIterator>::value, void>::type,
+ class = typename enable_if<__is_allocator<_Allocator>::value, void>::type
+ >
+basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
+ -> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
+#endif
+
+
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void