#include <bits/stl_iterator.h>
#include <bits/concept_check.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>
namespace std _GLIBCXX_VISIBILITY(default)
struct __iter_swap
{
template<typename _ForwardIterator1, typename _ForwardIterator2>
- static void
- iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
- {
- typedef typename iterator_traits<_ForwardIterator1>::value_type
- _ValueType1;
- _ValueType1 __tmp = _GLIBCXX_MOVE(*__a);
- *__a = _GLIBCXX_MOVE(*__b);
- *__b = _GLIBCXX_MOVE(__tmp);
+ static void
+ iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
+ {
+ typedef typename iterator_traits<_ForwardIterator1>::value_type
+ _ValueType1;
+ _ValueType1 __tmp = *__a;
+ *__a = *__b;
+ *__b = __tmp;
}
};
struct __iter_swap<true>
{
template<typename _ForwardIterator1, typename _ForwardIterator2>
- static void
- iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
- {
- swap(*__a, *__b);
- }
+ static void
+ iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
+ {
+ swap(*__a, *__b);
+ }
};
#endif
struct __copy_move
{
template<typename _II, typename _OI>
- static _OI
- __copy_m(_II __first, _II __last, _OI __result)
- {
+ static _OI
+ __copy_m(_II __first, _II __last, _OI __result)
+ {
for (; __first != __last; ++__result, (void)++__first)
*__result = *__first;
return __result;
struct __copy_move<true, false, _Category>
{
template<typename _II, typename _OI>
- static _OI
- __copy_m(_II __first, _II __last, _OI __result)
- {
+ static _OI
+ __copy_m(_II __first, _II __last, _OI __result)
+ {
for (; __first != __last; ++__result, (void)++__first)
*__result = std::move(*__first);
return __result;
struct __copy_move<false, false, random_access_iterator_tag>
{
template<typename _II, typename _OI>
- static _OI
- __copy_m(_II __first, _II __last, _OI __result)
- {
+ static _OI
+ __copy_m(_II __first, _II __last, _OI __result)
+ {
typedef typename iterator_traits<_II>::difference_type _Distance;
for(_Distance __n = __last - __first; __n > 0; --__n)
{
struct __copy_move<true, false, random_access_iterator_tag>
{
template<typename _II, typename _OI>
- static _OI
- __copy_m(_II __first, _II __last, _OI __result)
- {
+ static _OI
+ __copy_m(_II __first, _II __last, _OI __result)
+ {
typedef typename iterator_traits<_II>::difference_type _Distance;
for(_Distance __n = __last - __first; __n > 0; --__n)
{
struct __copy_move<_IsMove, true, random_access_iterator_tag>
{
template<typename _Tp>
- static _Tp*
- __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result)
- {
+ static _Tp*
+ __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result)
+ {
#if __cplusplus >= 201103L
using __assignable = conditional<_IsMove,
is_move_assignable<_Tp>,
typedef typename iterator_traits<_OI>::value_type _ValueTypeO;
typedef typename iterator_traits<_II>::iterator_category _Category;
const bool __simple = (__is_trivial(_ValueTypeI)
- && __is_pointer<_II>::__value
- && __is_pointer<_OI>::__value
+ && __is_pointer<_II>::__value
+ && __is_pointer<_OI>::__value
&& __are_same<_ValueTypeI, _ValueTypeO>::__value);
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).
class ostreambuf_iterator;
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
__copy_move_a2(_CharT*, _CharT*,
ostreambuf_iterator<_CharT, char_traits<_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
__copy_move_a2(const _CharT*, const _CharT*,
ostreambuf_iterator<_CharT, char_traits<_CharT> >);
struct __copy_move_backward
{
template<typename _BI1, typename _BI2>
- static _BI2
- __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
- {
+ static _BI2
+ __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
while (__first != __last)
*--__result = *--__last;
return __result;
struct __copy_move_backward<true, false, _Category>
{
template<typename _BI1, typename _BI2>
- static _BI2
- __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
- {
+ static _BI2
+ __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
while (__first != __last)
*--__result = std::move(*--__last);
return __result;
struct __copy_move_backward<false, false, random_access_iterator_tag>
{
template<typename _BI1, typename _BI2>
- static _BI2
- __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
- {
+ static _BI2
+ __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
typename iterator_traits<_BI1>::difference_type __n;
for (__n = __last - __first; __n > 0; --__n)
*--__result = *--__last;
struct __copy_move_backward<true, false, random_access_iterator_tag>
{
template<typename _BI1, typename _BI2>
- static _BI2
- __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
- {
+ static _BI2
+ __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result)
+ {
typename iterator_traits<_BI1>::difference_type __n;
for (__n = __last - __first; __n > 0; --__n)
*--__result = std::move(*--__last);
struct __copy_move_backward<_IsMove, true, random_access_iterator_tag>
{
template<typename _Tp>
- static _Tp*
- __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result)
- {
+ static _Tp*
+ __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result)
+ {
#if __cplusplus >= 201103L
using __assignable = conditional<_IsMove,
is_move_assignable<_Tp>,
typedef typename iterator_traits<_BI2>::value_type _ValueType2;
typedef typename iterator_traits<_BI1>::iterator_category _Category;
const bool __simple = (__is_trivial(_ValueType1)
- && __is_pointer<_BI1>::__value
- && __is_pointer<_BI2>::__value
+ && __is_pointer<_BI1>::__value
+ && __is_pointer<_BI2>::__value
&& __are_same<_ValueType1, _ValueType2>::__value);
return std::__copy_move_backward<_IsMove, __simple,
- _Category>::__copy_move_b(__first,
+ _Category>::__copy_move_b(__first,
__last,
__result);
}
for (; __first != __last; ++__first)
*__first = __value;
}
-
+
template<typename _ForwardIterator, typename _Tp>
inline typename
__gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type
struct __equal
{
template<typename _II1, typename _II2>
- static bool
- equal(_II1 __first1, _II1 __last1, _II2 __first2)
- {
+ static bool
+ equal(_II1 __first1, _II1 __last1, _II2 __first2)
+ {
for (; __first1 != __last1; ++__first1, (void)++__first2)
if (!(*__first1 == *__first2))
return false;
struct __equal<true>
{
template<typename _Tp>
- static bool
- equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2)
- {
+ static bool
+ equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2)
+ {
if (const size_t __len = (__last1 - __first1))
return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * __len);
return true;
typedef typename iterator_traits<_II2>::value_type _ValueType2;
const bool __simple = ((__is_integer<_ValueType1>::__value
|| __is_pointer<_ValueType1>::__value)
- && __is_pointer<_II1>::__value
- && __is_pointer<_II2>::__value
+ && __is_pointer<_II1>::__value
+ && __is_pointer<_II2>::__value
&& __are_same<_ValueType1, _ValueType2>::__value);
return std::__equal<__simple>::equal(__first1, __last1, __first2);
struct __lc_rai
{
template<typename _II1, typename _II2>
- static _II1
- __newlast1(_II1, _II1 __last1, _II2, _II2)
- { return __last1; }
+ static _II1
+ __newlast1(_II1, _II1 __last1, _II2, _II2)
+ { return __last1; }
template<typename _II>
- static bool
- __cnd2(_II __first, _II __last)
- { return __first != __last; }
+ static bool
+ __cnd2(_II __first, _II __last)
+ { return __first != __last; }
};
template<>
struct __lc_rai<random_access_iterator_tag, random_access_iterator_tag>
{
template<typename _RAI1, typename _RAI2>
- static _RAI1
- __newlast1(_RAI1 __first1, _RAI1 __last1,
+ static _RAI1
+ __newlast1(_RAI1 __first1, _RAI1 __last1,
_RAI2 __first2, _RAI2 __last2)
- {
+ {
const typename iterator_traits<_RAI1>::difference_type
__diff1 = __last1 - __first1;
const typename iterator_traits<_RAI2>::difference_type
}
template<typename _RAI>
- static bool
- __cnd2(_RAI, _RAI)
- { return true; }
+ static bool
+ __cnd2(_RAI, _RAI)
+ { return true; }
};
template<typename _II1, typename _II2, typename _Compare>
struct __lexicographical_compare
{
template<typename _II1, typename _II2>
- static bool __lc(_II1, _II1, _II2, _II2);
+ static bool __lc(_II1, _II1, _II2, _II2);
};
template<bool _BoolType>
struct __lexicographical_compare<true>
{
template<typename _Tp, typename _Up>
- static bool
- __lc(const _Tp* __first1, const _Tp* __last1,
+ static bool
+ __lc(const _Tp* __first1, const _Tp* __last1,
const _Up* __first2, const _Up* __last2)
{
const size_t __len1 = __last1 - __first1;
* @param __last Another iterator.
* @param __val The search term.
* @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.
* @ingroup binary_search_algorithms
*/
_InputIterator2 __first2, _BinaryPredicate __binary_pred)
{
while (__first1 != __last1 && __binary_pred(__first1, __first2))
- {
+ {
++__first1;
++__first2;
- }
+ }
return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
}
{
while (__first1 != __last1 && __first2 != __last2
&& __binary_pred(__first1, __first2))
- {
+ {
++__first1;
++__first2;
- }
+ }
return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
}
// NB: This file is included within many other C++ includes, as a way
// of getting the base algorithms. So, make sure that parallel bits
-// come in too if requested.
+// come in too if requested.
#ifdef _GLIBCXX_PARALLEL
# include <parallel/algobase.h>
#endif