summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/experimental/filesystem14
-rw-r--r--libcxx/include/string42
2 files changed, 30 insertions, 26 deletions
diff --git a/libcxx/include/experimental/filesystem b/libcxx/include/experimental/filesystem
index c674a03695f..410235f11a3 100644
--- a/libcxx/include/experimental/filesystem
+++ b/libcxx/include/experimental/filesystem
@@ -625,8 +625,18 @@ template <>
struct _PathCVT<char> {
template <class _Iter>
- static void __append_range(string& __dest, _Iter __b, _Iter __e) {
- __dest.append(__b, __e);
+ static typename enable_if<
+ __is_exactly_input_iterator<_Iter>::value
+ >::type __append_range(string& __dest, _Iter __b, _Iter __e) {
+ for (; __b != __e; ++__b)
+ __dest.push_back(*__b);
+ }
+
+ template <class _Iter>
+ static typename enable_if<
+ __is_forward_iterator<_Iter>::value
+ >::type __append_range(string& __dest, _Iter __b, _Iter __e) {
+ __dest.__append_forward_unsafe(__b, __e);
}
template <class _Iter>
diff --git a/libcxx/include/string b/libcxx/include/string
index b56ab384b5d..95fbce04119 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -926,6 +926,8 @@ public:
basic_string& append(const value_type* __s, size_type __n);
basic_string& append(const value_type* __s);
basic_string& append(size_type __n, value_type __c);
+ template <class _ForwardIterator>
+ basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator);
template<class _InputIterator>
typename enable_if
<
@@ -933,7 +935,12 @@ public:
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
basic_string&
>::type
- append(_InputIterator __first, _InputIterator __last);
+ _LIBCPP_INLINE_VISIBILITY
+ append(_InputIterator __first, _InputIterator __last) {
+ const basic_string __temp (__first, __last, __alloc());
+ append(__temp.data(), __temp.size());
+ return *this;
+ }
template<class _ForwardIterator>
typename enable_if
<
@@ -941,7 +948,11 @@ public:
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
basic_string&
>::type
- append(_ForwardIterator __first, _ForwardIterator __last);
+ _LIBCPP_INLINE_VISIBILITY
+ append(_ForwardIterator __first, _ForwardIterator __last) {
+ return __append_forward_unsafe(__first, __last);
+ }
+
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
@@ -2182,21 +2193,6 @@ basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
traits_type::assign(*++__p, value_type());
}
-template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator>
-typename enable_if
-<
- __is_exactly_input_iterator<_InputIterator>::value
- || !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
- basic_string<_CharT, _Traits, _Allocator>&
->::type
-basic_string<_CharT, _Traits, _Allocator>::append(_InputIterator __first, _InputIterator __last)
-{
- const basic_string __temp (__first, __last, __alloc());
- append(__temp.data(), __temp.size());
- return *this;
-}
-
template <class _Tp>
bool __ptr_in_range (const _Tp* __p, const _Tp* __first, const _Tp* __last)
{
@@ -2211,14 +2207,12 @@ bool __ptr_in_range (const _Tp1* __p, const _Tp2* __first, const _Tp2* __last)
template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
-typename enable_if
-<
- __is_forward_iterator<_ForwardIterator>::value
- && __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
- basic_string<_CharT, _Traits, _Allocator>&
->::type
-basic_string<_CharT, _Traits, _Allocator>::append(_ForwardIterator __first, _ForwardIterator __last)
+basic_string<_CharT, _Traits, _Allocator>&
+basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(
+ _ForwardIterator __first, _ForwardIterator __last)
{
+ static_assert(__is_forward_iterator<_ForwardIterator>::value,
+ "function requires a ForwardIterator");
size_type __sz = size();
size_type __cap = capacity();
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
OpenPOWER on IntegriCloud