// Core algorithmic facilities -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-// 2011 Free Software Foundation, Inc.
+// Copyright (C) 2001-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#if __cplusplus < 201103L
// See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a
// nutshell, we are partially implementing the resolution of DR 187,
// when it's safe, i.e., the value_types are equal.
swap(*__a, *__b);
}
};
+#endif
/**
* @brief Swaps the contents of two iterators.
inline void
iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)
{
- typedef typename iterator_traits<_ForwardIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_ForwardIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
_ForwardIterator1>)
__glibcxx_function_requires(_Mutable_ForwardIteratorConcept<
_ForwardIterator2>)
+
+#if __cplusplus < 201103L
+ typedef typename iterator_traits<_ForwardIterator1>::value_type
+ _ValueType1;
+ typedef typename iterator_traits<_ForwardIterator2>::value_type
+ _ValueType2;
+
__glibcxx_function_requires(_ConvertibleConcept<_ValueType1,
_ValueType2>)
__glibcxx_function_requires(_ConvertibleConcept<_ValueType2,
&& __are_same<_ValueType1&, _ReferenceType1>::__value
&& __are_same<_ValueType2&, _ReferenceType2>::__value>::
iter_swap(__a, __b);
+#else
+ swap(*__a, *__b);
+#endif
}
/**
}
};
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L
template<typename _Category>
struct __copy_move<true, false, _Category>
{
}
};
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L
template<>
struct __copy_move<true, false, random_access_iterator_tag>
{
__result));
}
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L
/**
* @brief Moves the range [first,last) into result.
* @ingroup mutating_algorithms
}
};
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L
template<typename _Category>
struct __copy_move_backward<true, false, _Category>
{
}
};
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L
template<>
struct __copy_move_backward<true, false, random_access_iterator_tag>
{
__result));
}
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L
/**
* @brief Moves the range [first,last) into result.
* @ingroup mutating_algorithms
lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
+#endif
typedef typename iterator_traits<_ForwardIterator>::difference_type
_DistanceType;
/// This is a helper function for the sort routines and for random.tcc.
// Precondition: __n > 0.
- template<typename _Size>
- inline _Size
- __lg(_Size __n)
- {
- _Size __k;
- for (__k = 0; __n != 0; __n >>= 1)
- ++__k;
- return __k - 1;
- }
-
- inline int
+ inline _GLIBCXX_CONSTEXPR int
__lg(int __n)
{ return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); }
- inline unsigned
+ inline _GLIBCXX_CONSTEXPR unsigned
__lg(unsigned __n)
{ return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); }
- inline long
+ inline _GLIBCXX_CONSTEXPR long
__lg(long __n)
{ return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); }
- inline unsigned long
+ inline _GLIBCXX_CONSTEXPR unsigned long
__lg(unsigned long __n)
{ return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); }
- inline long long
+ inline _GLIBCXX_CONSTEXPR long long
__lg(long long __n)
{ return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); }
- inline unsigned long long
+ inline _GLIBCXX_CONSTEXPR unsigned long long
__lg(unsigned long long __n)
{ return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); }
lexicographical_compare(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2)
{
+#ifdef _GLIBCXX_CONCEPT_CHECKS
// concept requirements
typedef typename iterator_traits<_II1>::value_type _ValueType1;
typedef typename iterator_traits<_II2>::value_type _ValueType2;
+#endif
__glibcxx_function_requires(_InputIteratorConcept<_II1>)
__glibcxx_function_requires(_InputIteratorConcept<_II2>)
__glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)