Commit e5795ce4 by François Dumont

stl_algobase.h (std::__iter_swap<false>): Remove _GLIBCXX_MOVE usage.

2017-05-10  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_algobase.h (std::__iter_swap<false>): Remove
	_GLIBCXX_MOVE usage.

From-SVN: r247855
parent d45d6282
2017-05-10 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_algobase.h (std::__iter_swap<false>): Remove
_GLIBCXX_MOVE usage.
2017-05-09 Jason Merrill <jason@redhat.com> 2017-05-09 Jason Merrill <jason@redhat.com>
* testsuite/24_iterators/container_access.cc (test03): Make il3 static. * testsuite/24_iterators/container_access.cc (test03): Make il3 static.
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#include <bits/stl_iterator.h> #include <bits/stl_iterator.h>
#include <bits/concept_check.h> #include <bits/concept_check.h>
#include <debug/debug.h> #include <debug/debug.h>
#include <bits/move.h> // For std::swap and _GLIBCXX_MOVE #include <bits/move.h> // For std::swap
#include <bits/predefined_ops.h> #include <bits/predefined_ops.h>
namespace std _GLIBCXX_VISIBILITY(default) namespace std _GLIBCXX_VISIBILITY(default)
...@@ -82,14 +82,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -82,14 +82,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __iter_swap struct __iter_swap
{ {
template<typename _ForwardIterator1, typename _ForwardIterator2> template<typename _ForwardIterator1, typename _ForwardIterator2>
static void static void
iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
{ {
typedef typename iterator_traits<_ForwardIterator1>::value_type typedef typename iterator_traits<_ForwardIterator1>::value_type
_ValueType1; _ValueType1;
_ValueType1 __tmp = _GLIBCXX_MOVE(*__a); _ValueType1 __tmp = *__a;
*__a = _GLIBCXX_MOVE(*__b); *__a = *__b;
*__b = _GLIBCXX_MOVE(__tmp); *__b = __tmp;
} }
}; };
...@@ -97,11 +97,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -97,11 +97,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __iter_swap<true> struct __iter_swap<true>
{ {
template<typename _ForwardIterator1, typename _ForwardIterator2> template<typename _ForwardIterator1, typename _ForwardIterator2>
static void static void
iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
{ {
swap(*__a, *__b); swap(*__a, *__b);
} }
}; };
#endif #endif
...@@ -287,9 +287,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -287,9 +287,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move struct __copy_move
{ {
template<typename _II, typename _OI> template<typename _II, typename _OI>
static _OI static _OI
__copy_m(_II __first, _II __last, _OI __result) __copy_m(_II __first, _II __last, _OI __result)
{ {
for (; __first != __last; ++__result, (void)++__first) for (; __first != __last; ++__result, (void)++__first)
*__result = *__first; *__result = *__first;
return __result; return __result;
...@@ -301,9 +301,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -301,9 +301,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move<true, false, _Category> struct __copy_move<true, false, _Category>
{ {
template<typename _II, typename _OI> template<typename _II, typename _OI>
static _OI static _OI
__copy_m(_II __first, _II __last, _OI __result) __copy_m(_II __first, _II __last, _OI __result)
{ {
for (; __first != __last; ++__result, (void)++__first) for (; __first != __last; ++__result, (void)++__first)
*__result = std::move(*__first); *__result = std::move(*__first);
return __result; return __result;
...@@ -315,9 +315,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -315,9 +315,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move<false, false, random_access_iterator_tag> struct __copy_move<false, false, random_access_iterator_tag>
{ {
template<typename _II, typename _OI> template<typename _II, typename _OI>
static _OI static _OI
__copy_m(_II __first, _II __last, _OI __result) __copy_m(_II __first, _II __last, _OI __result)
{ {
typedef typename iterator_traits<_II>::difference_type _Distance; typedef typename iterator_traits<_II>::difference_type _Distance;
for(_Distance __n = __last - __first; __n > 0; --__n) for(_Distance __n = __last - __first; __n > 0; --__n)
{ {
...@@ -334,9 +334,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -334,9 +334,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move<true, false, random_access_iterator_tag> struct __copy_move<true, false, random_access_iterator_tag>
{ {
template<typename _II, typename _OI> template<typename _II, typename _OI>
static _OI static _OI
__copy_m(_II __first, _II __last, _OI __result) __copy_m(_II __first, _II __last, _OI __result)
{ {
typedef typename iterator_traits<_II>::difference_type _Distance; typedef typename iterator_traits<_II>::difference_type _Distance;
for(_Distance __n = __last - __first; __n > 0; --__n) for(_Distance __n = __last - __first; __n > 0; --__n)
{ {
...@@ -353,9 +353,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -353,9 +353,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move<_IsMove, true, random_access_iterator_tag> struct __copy_move<_IsMove, true, random_access_iterator_tag>
{ {
template<typename _Tp> template<typename _Tp>
static _Tp* static _Tp*
__copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result) __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result)
{ {
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
using __assignable = conditional<_IsMove, using __assignable = conditional<_IsMove,
is_move_assignable<_Tp>, is_move_assignable<_Tp>,
...@@ -378,12 +378,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -378,12 +378,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef typename iterator_traits<_OI>::value_type _ValueTypeO; typedef typename iterator_traits<_OI>::value_type _ValueTypeO;
typedef typename iterator_traits<_II>::iterator_category _Category; typedef typename iterator_traits<_II>::iterator_category _Category;
const bool __simple = (__is_trivial(_ValueTypeI) const bool __simple = (__is_trivial(_ValueTypeI)
&& __is_pointer<_II>::__value && __is_pointer<_II>::__value
&& __is_pointer<_OI>::__value && __is_pointer<_OI>::__value
&& __are_same<_ValueTypeI, _ValueTypeO>::__value); && __are_same<_ValueTypeI, _ValueTypeO>::__value);
return std::__copy_move<_IsMove, __simple, return std::__copy_move<_IsMove, __simple,
_Category>::__copy_m(__first, __last, __result); _Category>::__copy_m(__first, __last, __result);
} }
// Helpers for streambuf iterators (either istream or ostream). // Helpers for streambuf iterators (either istream or ostream).
...@@ -398,13 +398,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -398,13 +398,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class ostreambuf_iterator; class ostreambuf_iterator;
template<bool _IsMove, typename _CharT> template<bool _IsMove, typename _CharT>
typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type
__copy_move_a2(_CharT*, _CharT*, __copy_move_a2(_CharT*, _CharT*,
ostreambuf_iterator<_CharT, char_traits<_CharT> >); ostreambuf_iterator<_CharT, char_traits<_CharT> >);
template<bool _IsMove, typename _CharT> template<bool _IsMove, typename _CharT>
typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type
__copy_move_a2(const _CharT*, const _CharT*, __copy_move_a2(const _CharT*, const _CharT*,
ostreambuf_iterator<_CharT, char_traits<_CharT> >); ostreambuf_iterator<_CharT, char_traits<_CharT> >);
...@@ -497,9 +497,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -497,9 +497,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward struct __copy_move_backward
{ {
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
static _BI2 static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
while (__first != __last) while (__first != __last)
*--__result = *--__last; *--__result = *--__last;
return __result; return __result;
...@@ -511,9 +511,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -511,9 +511,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward<true, false, _Category> struct __copy_move_backward<true, false, _Category>
{ {
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
static _BI2 static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
while (__first != __last) while (__first != __last)
*--__result = std::move(*--__last); *--__result = std::move(*--__last);
return __result; return __result;
...@@ -525,9 +525,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -525,9 +525,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward<false, false, random_access_iterator_tag> struct __copy_move_backward<false, false, random_access_iterator_tag>
{ {
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
static _BI2 static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
typename iterator_traits<_BI1>::difference_type __n; typename iterator_traits<_BI1>::difference_type __n;
for (__n = __last - __first; __n > 0; --__n) for (__n = __last - __first; __n > 0; --__n)
*--__result = *--__last; *--__result = *--__last;
...@@ -540,9 +540,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -540,9 +540,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward<true, false, random_access_iterator_tag> struct __copy_move_backward<true, false, random_access_iterator_tag>
{ {
template<typename _BI1, typename _BI2> template<typename _BI1, typename _BI2>
static _BI2 static _BI2
__copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
{ {
typename iterator_traits<_BI1>::difference_type __n; typename iterator_traits<_BI1>::difference_type __n;
for (__n = __last - __first; __n > 0; --__n) for (__n = __last - __first; __n > 0; --__n)
*--__result = std::move(*--__last); *--__result = std::move(*--__last);
...@@ -555,9 +555,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -555,9 +555,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __copy_move_backward<_IsMove, true, random_access_iterator_tag> struct __copy_move_backward<_IsMove, true, random_access_iterator_tag>
{ {
template<typename _Tp> template<typename _Tp>
static _Tp* static _Tp*
__copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result) __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result)
{ {
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
using __assignable = conditional<_IsMove, using __assignable = conditional<_IsMove,
is_move_assignable<_Tp>, is_move_assignable<_Tp>,
...@@ -580,12 +580,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -580,12 +580,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef typename iterator_traits<_BI2>::value_type _ValueType2; typedef typename iterator_traits<_BI2>::value_type _ValueType2;
typedef typename iterator_traits<_BI1>::iterator_category _Category; typedef typename iterator_traits<_BI1>::iterator_category _Category;
const bool __simple = (__is_trivial(_ValueType1) const bool __simple = (__is_trivial(_ValueType1)
&& __is_pointer<_BI1>::__value && __is_pointer<_BI1>::__value
&& __is_pointer<_BI2>::__value && __is_pointer<_BI2>::__value
&& __are_same<_ValueType1, _ValueType2>::__value); && __are_same<_ValueType1, _ValueType2>::__value);
return std::__copy_move_backward<_IsMove, __simple, return std::__copy_move_backward<_IsMove, __simple,
_Category>::__copy_move_b(__first, _Category>::__copy_move_b(__first,
__last, __last,
__result); __result);
} }
...@@ -684,7 +684,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -684,7 +684,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
*__first = __value; *__first = __value;
} }
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
inline typename inline typename
__gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type
...@@ -793,9 +793,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -793,9 +793,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __equal struct __equal
{ {
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
static bool static bool
equal(_II1 __first1, _II1 __last1, _II2 __first2) equal(_II1 __first1, _II1 __last1, _II2 __first2)
{ {
for (; __first1 != __last1; ++__first1, (void)++__first2) for (; __first1 != __last1; ++__first1, (void)++__first2)
if (!(*__first1 == *__first2)) if (!(*__first1 == *__first2))
return false; return false;
...@@ -807,9 +807,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -807,9 +807,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __equal<true> struct __equal<true>
{ {
template<typename _Tp> template<typename _Tp>
static bool static bool
equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2) equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2)
{ {
if (const size_t __len = (__last1 - __first1)) if (const size_t __len = (__last1 - __first1))
return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * __len); return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * __len);
return true; return true;
...@@ -824,8 +824,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -824,8 +824,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef typename iterator_traits<_II2>::value_type _ValueType2; typedef typename iterator_traits<_II2>::value_type _ValueType2;
const bool __simple = ((__is_integer<_ValueType1>::__value const bool __simple = ((__is_integer<_ValueType1>::__value
|| __is_pointer<_ValueType1>::__value) || __is_pointer<_ValueType1>::__value)
&& __is_pointer<_II1>::__value && __is_pointer<_II1>::__value
&& __is_pointer<_II2>::__value && __is_pointer<_II2>::__value
&& __are_same<_ValueType1, _ValueType2>::__value); && __are_same<_ValueType1, _ValueType2>::__value);
return std::__equal<__simple>::equal(__first1, __last1, __first2); return std::__equal<__simple>::equal(__first1, __last1, __first2);
...@@ -835,24 +835,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -835,24 +835,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __lc_rai struct __lc_rai
{ {
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
static _II1 static _II1
__newlast1(_II1, _II1 __last1, _II2, _II2) __newlast1(_II1, _II1 __last1, _II2, _II2)
{ return __last1; } { return __last1; }
template<typename _II> template<typename _II>
static bool static bool
__cnd2(_II __first, _II __last) __cnd2(_II __first, _II __last)
{ return __first != __last; } { return __first != __last; }
}; };
template<> template<>
struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag> struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag>
{ {
template<typename _RAI1, typename _RAI2> template<typename _RAI1, typename _RAI2>
static _RAI1 static _RAI1
__newlast1(_RAI1 __first1, _RAI1 __last1, __newlast1(_RAI1 __first1, _RAI1 __last1,
_RAI2 __first2, _RAI2 __last2) _RAI2 __first2, _RAI2 __last2)
{ {
const typename iterator_traits<_RAI1>::difference_type const typename iterator_traits<_RAI1>::difference_type
__diff1 = __last1 - __first1; __diff1 = __last1 - __first1;
const typename iterator_traits<_RAI2>::difference_type const typename iterator_traits<_RAI2>::difference_type
...@@ -861,9 +861,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -861,9 +861,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _RAI> template<typename _RAI>
static bool static bool
__cnd2(_RAI, _RAI) __cnd2(_RAI, _RAI)
{ return true; } { return true; }
}; };
template<typename _II1, typename _II2, typename _Compare> template<typename _II1, typename _II2, typename _Compare>
...@@ -892,7 +892,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -892,7 +892,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __lexicographical_compare struct __lexicographical_compare
{ {
template<typename _II1, typename _II2> template<typename _II1, typename _II2>
static bool __lc(_II1, _II1, _II2, _II2); static bool __lc(_II1, _II1, _II2, _II2);
}; };
template<bool _BoolType> template<bool _BoolType>
...@@ -910,8 +910,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -910,8 +910,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __lexicographical_compare<true> struct __lexicographical_compare<true>
{ {
template<typename _Tp, typename _Up> template<typename _Tp, typename _Up>
static bool static bool
__lc(const _Tp* __first1, const _Tp* __last1, __lc(const _Tp* __first1, const _Tp* __last1,
const _Up* __first2, const _Up* __last2) const _Up* __first2, const _Up* __last2)
{ {
const size_t __len1 = __last1 - __first1; const size_t __len1 = __last1 - __first1;
...@@ -975,7 +975,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -975,7 +975,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __last Another iterator. * @param __last Another iterator.
* @param __val The search term. * @param __val The search term.
* @return An iterator pointing to the first element <em>not less * @return An iterator pointing to the first element <em>not less
* than</em> @a val, or end() if every element is less than * than</em> @a val, or end() if every element is less than
* @a val. * @a val.
* @ingroup binary_search_algorithms * @ingroup binary_search_algorithms
*/ */
...@@ -1257,10 +1257,10 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1257,10 +1257,10 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
_InputIterator2 __first2, _BinaryPredicate __binary_pred) _InputIterator2 __first2, _BinaryPredicate __binary_pred)
{ {
while (__first1 != __last1 && __binary_pred(__first1, __first2)) while (__first1 != __last1 && __binary_pred(__first1, __first2))
{ {
++__first1; ++__first1;
++__first2; ++__first2;
} }
return pair<_InputIterator1, _InputIterator2>(__first1, __first2); return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
} }
...@@ -1336,10 +1336,10 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO ...@@ -1336,10 +1336,10 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
{ {
while (__first1 != __last1 && __first2 != __last2 while (__first1 != __last1 && __first2 != __last2
&& __binary_pred(__first1, __first2)) && __binary_pred(__first1, __first2))
{ {
++__first1; ++__first1;
++__first2; ++__first2;
} }
return pair<_InputIterator1, _InputIterator2>(__first1, __first2); return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
} }
...@@ -1415,7 +1415,7 @@ _GLIBCXX_END_NAMESPACE_ALGO ...@@ -1415,7 +1415,7 @@ _GLIBCXX_END_NAMESPACE_ALGO
// NB: This file is included within many other C++ includes, as a way // NB: This file is included within many other C++ includes, as a way
// of getting the base algorithms. So, make sure that parallel bits // of getting the base algorithms. So, make sure that parallel bits
// come in too if requested. // come in too if requested.
#ifdef _GLIBCXX_PARALLEL #ifdef _GLIBCXX_PARALLEL
# include <parallel/algobase.h> # include <parallel/algobase.h>
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment