diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/stdapis/stlportv5/stl/_algo.h --- a/epoc32/include/stdapis/stlportv5/stl/_algo.h Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/stdapis/stlportv5/stl/_algo.h Wed Mar 31 12:33:34 2010 +0100 @@ -9,13 +9,13 @@ * Copyright (c) 1997 * Moscow Center for SPARC Technology * - * Copyright (c) 1999 + * Copyright (c) 1999 * Boris Fomitchev * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * - * Permission to use or copy this software for any purpose is hereby granted + * Permission to use or copy this software for any purpose is hereby granted * without fee, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was @@ -30,36 +30,32 @@ #ifndef _STLP_INTERNAL_ALGO_H #define _STLP_INTERNAL_ALGO_H -# ifndef _STLP_INTERNAL_ALGOBASE_H +#ifndef _STLP_INTERNAL_ALGOBASE_H # include -# endif +#endif -# ifndef _STLP_INTERNAL_TEMPBUF_H -# include -# endif +#ifndef _STLP_INTERNAL_HEAP_H +# include +#endif -# ifndef _STLP_INTERNAL_HEAP_H -# include -# endif +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif -# ifndef _STLP_INTERNAL_ITERATOR_H -# include -# endif +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif -# ifndef _STLP_INTERNAL_FUNCTION_BASE_H -# include -# endif - -# ifdef __SUNPRO_CC +#if defined (__SUNPRO_CC) && !defined (_STLP_INTERNAL_CSTDIO) // remove() conflict -# include -# endif +# include +#endif _STLP_BEGIN_NAMESPACE // for_each. Apply a function to every element of a range. template -_STLP_INLINE_LOOP _Function +_STLP_INLINE_LOOP _Function for_each(_InputIter __first, _InputIter __last, _Function __f) { for ( ; __first != __last; ++__first) __f(*__first); @@ -70,21 +66,22 @@ template _STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter) count_if(_InputIter __first, _InputIter __last, _Predicate __pred) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) -_STLP_DIFFERENCE_TYPE(_InputIter) __n = 0; - for ( ; __first != __last; ++__first) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0; + for ( ; __first != __last; ++__first) { if (__pred(*__first)) ++__n; + } return __n; } // adjacent_find. template -_STLP_INLINE_LOOP _ForwardIter +_STLP_INLINE_LOOP _ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last, _BinaryPredicate __binary_pred) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) if (__first == __last) return __last; _ForwardIter __next = __first; @@ -97,31 +94,31 @@ } template -_STLP_INLINE_LOOP _ForwardIter +_STLP_INLINE_LOOP _ForwardIter adjacent_find(_ForwardIter __first, _ForwardIter __last) { return adjacent_find(__first, __last, - __equal_to(_STLP_VALUE_TYPE(__first, _ForwardIter))); + _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _ForwardIter))); } -# ifndef _STLP_NO_ANACHRONISMS +#if !defined (_STLP_NO_ANACHRONISMS) template -_STLP_INLINE_LOOP void +_STLP_INLINE_LOOP void count(_InputIter __first, _InputIter __last, const _Tp& __val, _Size& __n) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) for ( ; __first != __last; ++__first) if (*__first == __val) ++__n; } template -_STLP_INLINE_LOOP void +_STLP_INLINE_LOOP void count_if(_InputIter __first, _InputIter __last, _Predicate __pred, _Size& __n) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) for ( ; __first != __last; ++__first) if (__pred(*__first)) ++__n; } -# endif +#endif template _ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, @@ -138,30 +135,31 @@ template inline _InputIter find_first_of(_InputIter __first1, _InputIter __last1, _ForwardIter __first2, _ForwardIter __last2) { - _STLP_DEBUG_CHECK(__check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(__check_range(__first2, __last2)) - return __find_first_of(__first1, __last1, __first2, __last2,__equal_to(_STLP_VALUE_TYPE(__first1, _InputIter))); + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, + _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _InputIter))); } template -inline _InputIter +inline _InputIter find_first_of(_InputIter __first1, _InputIter __last1, - _ForwardIter __first2, _ForwardIter __last2,_BinaryPredicate __comp) { - _STLP_DEBUG_CHECK(__check_range(__first1, __last1)) - _STLP_DEBUG_CHECK(__check_range(__first2, __last2)) - return __find_first_of(__first1, __last1, __first2, __last2,__comp); + _ForwardIter __first2, _ForwardIter __last2, _BinaryPredicate __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, __comp); } template -_ForwardIter1 -find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, +_ForwardIter1 +find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2, _ForwardIter2 __last2); // swap_ranges template -_STLP_INLINE_LOOP _ForwardIter2 +_STLP_INLINE_LOOP _ForwardIter2 swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2) { - _STLP_DEBUG_CHECK(__check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) for ( ; __first1 != __last1; ++__first1, ++__first2) iter_swap(__first1, __first2); return __first2; @@ -169,18 +167,18 @@ // transform template -_STLP_INLINE_LOOP _OutputIter +_STLP_INLINE_LOOP _OutputIter transform(_InputIter __first, _InputIter __last, _OutputIter __result, _UnaryOperation __opr) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) for ( ; __first != __last; ++__first, ++__result) *__result = __opr(*__first); return __result; } template -_STLP_INLINE_LOOP _OutputIter -transform(_InputIter1 __first1, _InputIter1 __last1, +_STLP_INLINE_LOOP _OutputIter +transform(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _OutputIter __result,_BinaryOperation __binary_op) { - _STLP_DEBUG_CHECK(__check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result) *__result = __binary_op(*__first1, *__first2); return __result; @@ -189,30 +187,30 @@ // replace_if, replace_copy, replace_copy_if template -_STLP_INLINE_LOOP void +_STLP_INLINE_LOOP void replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp& __new_value) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) for ( ; __first != __last; ++__first) if (__pred(*__first)) *__first = __new_value; } template -_STLP_INLINE_LOOP _OutputIter +_STLP_INLINE_LOOP _OutputIter replace_copy(_InputIter __first, _InputIter __last,_OutputIter __result, const _Tp& __old_value, const _Tp& __new_value) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) for ( ; __first != __last; ++__first, ++__result) *__result = *__first == __old_value ? __new_value : *__first; return __result; } template -_STLP_INLINE_LOOP _OutputIter +_STLP_INLINE_LOOP _OutputIter replace_copy_if(_Iterator __first, _Iterator __last, _OutputIter __result, _Predicate __pred, const _Tp& __new_value) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) for ( ; __first != __last; ++__first, ++__result) *__result = __pred(*__first) ? __new_value : *__first; return __result; @@ -221,64 +219,65 @@ // generate and generate_n template -_STLP_INLINE_LOOP void +_STLP_INLINE_LOOP void generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) for ( ; __first != __last; ++__first) *__first = __gen(); } template -_STLP_INLINE_LOOP _OutputIter +_STLP_INLINE_LOOP void generate_n(_OutputIter __first, _Size __n, _Generator __gen) { for ( ; __n > 0; --__n, ++__first) *__first = __gen(); - return __first; } // remove, remove_if, remove_copy, remove_copy_if template -_STLP_INLINE_LOOP _OutputIter +_STLP_INLINE_LOOP _OutputIter remove_copy(_InputIter __first, _InputIter __last,_OutputIter __result, const _Tp& __val) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - for ( ; __first != __last; ++__first) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) { if (!(*__first == __val)) { *__result = *__first; ++__result; } + } return __result; } template -_STLP_INLINE_LOOP _OutputIter +_STLP_INLINE_LOOP _OutputIter remove_copy_if(_InputIter __first, _InputIter __last, _OutputIter __result, _Predicate __pred) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - for ( ; __first != __last; ++__first) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) { if (!__pred(*__first)) { *__result = *__first; ++__result; } + } return __result; } template -_STLP_INLINE_LOOP _ForwardIter +_STLP_INLINE_LOOP _ForwardIter remove(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) __first = find(__first, __last, __val); if (__first == __last) return __first; - else { + else { _ForwardIter __next = __first; return remove_copy(++__next, __last, __first, __val); } } template -_STLP_INLINE_LOOP _ForwardIter +_STLP_INLINE_LOOP _ForwardIter remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) __first = find_if(__first, __last, __pred); if ( __first == __last ) return __first; @@ -304,7 +303,7 @@ template inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last, - _BinaryPredicate __binary_pred) { + _BinaryPredicate __binary_pred) { __first = adjacent_find(__first, __last, __binary_pred); return unique_copy(__first, __last, __first, __binary_pred); } @@ -312,32 +311,33 @@ // reverse and reverse_copy, and their auxiliary functions template -_STLP_INLINE_LOOP void +_STLP_INLINE_LOOP void __reverse(_BidirectionalIter __first, _BidirectionalIter __last, const bidirectional_iterator_tag &) { - for(; __first != __last && __first != --__last; ++__first) + for (; __first != __last && __first != --__last; ++__first) iter_swap(__first,__last); } template -_STLP_INLINE_LOOP void +_STLP_INLINE_LOOP void __reverse(_RandomAccessIter __first, _RandomAccessIter __last, const random_access_iterator_tag &) { - for (; __first < __last; ++__first) iter_swap(__first, --__last); + for (; __first < __last; ++__first) + iter_swap(__first, --__last); } template -inline void +inline void reverse(_BidirectionalIter __first, _BidirectionalIter __last) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) __reverse(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _BidirectionalIter)); } template _STLP_INLINE_LOOP _OutputIter reverse_copy(_BidirectionalIter __first, - _BidirectionalIter __last, - _OutputIter __result) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) + _BidirectionalIter __last, + _OutputIter __result) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) while (__first != __last) { --__last; *__result = *__last; @@ -346,13 +346,13 @@ return __result; } +_STLP_MOVE_TO_PRIV_NAMESPACE + // rotate and rotate_copy, and their auxiliary functions - template _STLP_INLINE_LOOP _EuclideanRingElement __gcd(_EuclideanRingElement __m, - _EuclideanRingElement __n) -{ + _EuclideanRingElement __n) { while (__n != 0) { _EuclideanRingElement __t = __m % __n; __m = __n; @@ -361,9 +361,10 @@ return __m; } +_STLP_MOVE_TO_STD_NAMESPACE + template -_ForwardIter -rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last); +void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last); template inline _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle, @@ -380,17 +381,17 @@ void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last, _RandomNumberGenerator& __rand); -# ifndef _STLP_NO_EXTENSIONS +#if !defined (_STLP_NO_EXTENSIONS) // random_sample and random_sample_n (extensions, not part of the standard). template _OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, - _OutputIter __stl_out, const _Distance __n); + _OutputIter __out_ite, const _Distance __n); template _OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, - _OutputIter __stl_out, const _Distance __n, + _OutputIter __out_ite, const _Distance __n, _RandomNumberGenerator& __rand); template @@ -398,26 +399,26 @@ random_sample(_InputIter __first, _InputIter __last, _RandomAccessIter __out_first, _RandomAccessIter __out_last); -template _RandomAccessIter random_sample(_InputIter __first, _InputIter __last, _RandomAccessIter __out_first, _RandomAccessIter __out_last, _RandomNumberGenerator& __rand); -# endif /* _STLP_NO_EXTENSIONS */ +#endif /* _STLP_NO_EXTENSIONS */ // partition, stable_partition, and their auxiliary functions template _ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred); - template -_ForwardIter +_ForwardIter stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred); -// sort() and its auxiliary functions. +// sort() and its auxiliary functions. +_STLP_MOVE_TO_PRIV_NAMESPACE template inline _Size __lg(_Size __n) { @@ -426,6 +427,8 @@ return __k; } +_STLP_MOVE_TO_STD_NAMESPACE + template void sort(_RandomAccessIter __first, _RandomAccessIter __last); template @@ -434,22 +437,21 @@ // stable_sort() and its auxiliary functions. template void stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last); + _RandomAccessIter __last); template void stable_sort(_RandomAccessIter __first, - _RandomAccessIter __last, _Compare __comp); + _RandomAccessIter __last, _Compare __comp); // partial_sort, partial_sort_copy, and auxiliary functions. template -void -partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle, _RandomAccessIter __last); +void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, + _RandomAccessIter __last); template -void -partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle, - _RandomAccessIter __last, _Compare __comp); +void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle, + _RandomAccessIter __last, _Compare __comp); template _RandomAccessIter @@ -462,8 +464,7 @@ _RandomAccessIter __result_first, _RandomAccessIter __result_last, _Compare __comp); -// nth_element() and its auxiliary functions. - +// nth_element() and its auxiliary functions. template void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, _RandomAccessIter __last); @@ -473,97 +474,114 @@ _RandomAccessIter __last, _Compare __comp); // auxiliary class for lower_bound, etc. +_STLP_MOVE_TO_PRIV_NAMESPACE + template struct __less_2 { - bool operator() (const _T1& __x, const _T2 __y) const { return __x < __y ; } + bool operator() (const _T1& __x, const _T2& __y) const { return __x < __y ; } }; template __less_2<_T1,_T2> __less2(_T1*, _T2* ) { return __less_2<_T1, _T2>(); } -#ifdef _STLP_FUNCTION_PARTIAL_ORDER +#if defined (_STLP_FUNCTION_PARTIAL_ORDER) template less<_Tp> __less2(_Tp*, _Tp* ) { return less<_Tp>(); } #endif +_STLP_MOVE_TO_STD_NAMESPACE + // Binary search (lower_bound, upper_bound, equal_range, binary_search). - template inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - return __lower_bound(__first, __last, __val, - __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __lower_bound(__first, __last, __val, + _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), + _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); } template inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - return __lower_bound(__first, __last, __val, __comp, _STLP_DISTANCE_TYPE(__first, _ForwardIter)); + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp, + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); } -template -_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, _Compare __comp, _Distance*); +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Compare1 __comp1, _Compare2 __comp2, _Distance*); + +_STLP_MOVE_TO_STD_NAMESPACE template inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - return __upper_bound(__first, __last, __val, - __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __upper_bound(__first, __last, __val, + _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), + _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); } template inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - return __upper_bound(__first, __last, __val, __comp, - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __upper_bound(__first, __last, __val, __comp, __comp, + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); } -template +_STLP_MOVE_TO_PRIV_NAMESPACE + +template pair<_ForwardIter, _ForwardIter> __equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, - _Compare __comp, _Distance*); + _Compare1 __comp1, _Compare2 __comp2, _Distance*); + +_STLP_MOVE_TO_STD_NAMESPACE template inline pair<_ForwardIter, _ForwardIter> equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - return __equal_range(__first, __last, __val, - __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __equal_range(__first, __last, __val, + _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), + _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); } template inline pair<_ForwardIter, _ForwardIter> equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - return __equal_range(__first, __last, __val, __comp, - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); -} + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __equal_range(__first, __last, __val, __comp, __comp, + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); +} template inline bool binary_search(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - _ForwardIter __i = __lower_bound(__first, __last, __val, - __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), - _STLP_DISTANCE_TYPE(__first, _ForwardIter)); + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, + _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), + _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); return __i != __last && !(__val < *__i); } template inline bool binary_search(_ForwardIter __first, _ForwardIter __last, - const _Tp& __val, - _Compare __comp) { - _STLP_DEBUG_CHECK(__check_range(__first, __last)) - _ForwardIter __i = __lower_bound(__first, __last, __val, __comp, _STLP_DISTANCE_TYPE(__first, _ForwardIter)); + const _Tp& __val, + _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp, + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); return __i != __last && !__comp(__val, *__i); } @@ -573,7 +591,7 @@ _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result); - + template _OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, @@ -581,18 +599,18 @@ _OutputIter __result, _Compare __comp); -// inplace_merge and its auxiliary functions. +// inplace_merge and its auxiliary functions. template void inplace_merge(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last) ; + _BidirectionalIter __middle, + _BidirectionalIter __last) ; template void inplace_merge(_BidirectionalIter __first, - _BidirectionalIter __middle, - _BidirectionalIter __last, _Compare __comp); + _BidirectionalIter __middle, + _BidirectionalIter __last, _Compare __comp); // Set algorithms: includes, set_union, set_intersection, set_difference, // set_symmetric_difference. All of these algorithms have the precondition @@ -606,7 +624,7 @@ template bool includes(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _Compare __comp); - + template _OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, @@ -636,14 +654,14 @@ _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result); -template _OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, - _InputIter2 __first2, _InputIter2 __last2, + _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result, _Compare __comp); template -_OutputIter +_OutputIter set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result); @@ -651,7 +669,7 @@ template -_OutputIter +_OutputIter set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2, _OutputIter __result, @@ -674,7 +692,7 @@ _ForwardIter min_element(_ForwardIter __first, _ForwardIter __last, _Compare __comp); -// next_permutation and prev_permutation, with and without an explicitly +// next_permutation and prev_permutation, with and without an explicitly // supplied comparison function. template @@ -693,8 +711,7 @@ bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last, _Compare __comp); -# ifndef _STLP_NO_EXTENSIONS - +#if !defined (_STLP_NO_EXTENSIONS) // is_heap, a predicate testing whether or not a range is // a heap. This function is an extension, not part of the C++ // standard. @@ -704,33 +721,36 @@ template bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last, - _StrictWeakOrdering __comp); - + _StrictWeakOrdering __comp); // is_sorted, a predicated testing whether a range is sorted in // nondescending order. This is an extension, not part of the C++ // standard. +_STLP_MOVE_TO_PRIV_NAMESPACE + template bool __is_sorted(_ForwardIter __first, _ForwardIter __last, _StrictWeakOrdering __comp); +_STLP_MOVE_TO_STD_NAMESPACE template inline bool is_sorted(_ForwardIter __first, _ForwardIter __last) { - return __is_sorted(__first, __last, __less(_STLP_VALUE_TYPE(__first, _ForwardIter))); + return _STLP_PRIV __is_sorted(__first, __last, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _ForwardIter))); } template inline bool is_sorted(_ForwardIter __first, _ForwardIter __last, _StrictWeakOrdering __comp) { - return __is_sorted(__first, __last, __comp); + return _STLP_PRIV __is_sorted(__first, __last, __comp); } -# endif +#endif _STLP_END_NAMESPACE -# if !defined (_STLP_LINK_TIME_INSTANTIATION) +#if !defined (_STLP_LINK_TIME_INSTANTIATION) # include -# endif +#endif #endif /* _STLP_INTERNAL_ALGO_H */