30#ifndef _STLP_INTERNAL_ALGOBASE_H
31#define _STLP_INTERNAL_ALGOBASE_H
33#ifndef _STLP_INTERNAL_CSTDDEF
37#ifndef _STLP_INTERNAL_CSTRING
45#ifndef _STLP_INTERNAL_CSTDLIB
49#ifndef _STLP_INTERNAL_PAIR_H
53#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
57#ifndef _STLP_TYPE_TRAITS_H
63#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
66inline void __swap_aux(_Tp& __a, _Tp& __b,
const __true_type& ) {
67 __a._M_swap_workaround(__b);
71inline void __swap_aux(_Tp& __a, _Tp& __b,
const __false_type& ) {
81inline void swap(_Tp& __a, _Tp& __b) {
82#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
83# if !defined(__BORLANDC__)
84 typedef typename _SwapImplemented<_Tp>::_Ret _Implemented;
86 enum { _Is = _SwapImplemented<_Tp>::_Is };
89 _STLP_PRIV __swap_aux(__a, __b, _Implemented());
99template <
class _ForwardIter1,
class _ForwardIter2,
class _Value>
106template <
class _ForwardIter1,
class _ForwardIter2>
112template <
class _ForwardIter1,
class _ForwardIter2>
119template <
class _ForwardIter1,
class _ForwardIter2>
120inline void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2) {
129#if !defined (__BORLANDC__) || defined (_STLP_USE_OWN_NAMESPACE)
130# if (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) && !defined (__STDC__)
135using _STLP_VENDOR_STD::min;
136using _STLP_VENDOR_STD::max;
139inline const _Tp& (
min)(
const _Tp& __a,
const _Tp& __b) {
return __b < __a ? __b : __a; }
141inline const _Tp& (
max)(
const _Tp& __a,
const _Tp& __b) {
return __a < __b ? __b : __a; }
145# if defined (__BORLANDC__) && defined (_STLP_USE_OWN_NAMESPACE)
146inline unsigned long (
min) (
unsigned long __a,
unsigned long __b) {
return __b < __a ? __b : __a; }
147inline unsigned long (
max) (
unsigned long __a,
unsigned long __b) {
return __a < __b ? __b : __a; }
150# if !defined (__BORLANDC__) || (__BORLANDC__ < 0x590)
151template <
class _Tp,
class _Compare>
152inline const _Tp& (
min)(
const _Tp& __a,
const _Tp& __b, _Compare __comp) {
153 return __comp(__b, __a) ? __b : __a;
156template <
class _Tp,
class _Compare>
157inline const _Tp& (
max)(
const _Tp& __a,
const _Tp& __b, _Compare __comp) {
158 return __comp(__a, __b) ? __b : __a;
161template <
class _Tp,
class _Compare>
162inline const _Tp (
min)(
const _Tp __a,
const _Tp __b, _Compare __comp) {
163 return __comp(__b, __a) ? __b : __a;
166template <
class _Tp,
class _Compare>
167inline const _Tp (
max)(
const _Tp __a,
const _Tp __b, _Compare __comp) {
168 return __comp(__a, __b) ? __b : __a;
183template <
class _InputIter,
class _OutputIter,
class _Distance>
186 for ( ; __first !=
__last; ++__result, ++__first)
187 *__result = *__first;
191#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
192template <
class _InputIter,
class _OutputIter,
class _Distance>
193inline _OutputIter
__copy(_InputIter __first, _InputIter
__last,
195 for ( ; __first !=
__last; ++__result, ++__first)
196 *__result = *__first;
200template <
class _InputIter,
class _OutputIter,
class _Distance>
201inline _OutputIter
__copy(_InputIter __first, _InputIter
__last,
203 for ( ; __first !=
__last; ++__result, ++__first)
204 *__result = *__first;
209template <
class _RandomAccessIter,
class _OutputIter,
class _Distance>
214 *__result = *__first;
223 size_t __n = (
const char*)
__last - (
const char*)__first;
224 return __n ? (
void *)((
char*)
memmove(__result, __first,
__n) +
__n) : __result;
230template <
class _BidirectionalIter1,
class _BidirectionalIter2,
233 _BidirectionalIter1
__last,
234 _BidirectionalIter2 __result,
242template <
class _RandomAccessIter,
class _B
idirectionalIter,
class _Distance>
245 _BidirectionalIter __result,
256 return (_Num > 0) ?
memmove((
char*)__result - _Num, __first, _Num) : __result ;
259template <
class _InputIter,
class _OutputIter>
264template <
class _InputIter,
class _OutputIter>
272template <
class _InputIter,
class _OutputIter>
280template <
class _InputIter,
class _OutputIter>
290template <
class _InputIter,
class _OutputIter>
291inline _OutputIter
copy(_InputIter __first, _InputIter
__last, _OutputIter __result) {
298template <
class _InputIter,
class _OutputIter>
305template <
class _InputIter,
class _OutputIter>
311template <
class _InputIter,
class _OutputIter>
318template <
class _InputIter,
class _OutputIter>
327template <
class _InputIter,
class _OutputIter>
333#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
334# define _STLP_DECLARE_COPY_TRIVIAL(_Tp) \
335inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) \
336{ return (_Tp*)_STLP_PRIV __copy_trivial(__first, __last, __result); } \
337inline _Tp* copy_backward(const _Tp* __first, const _Tp* __last, _Tp* __result) \
338{ return (_Tp*)_STLP_PRIV __copy_trivial_backward(__first, __last, __result); }
340# if !defined (_STLP_NO_BOOL)
344# if !defined (_STLP_NO_SIGNED_BUILTINS)
354# if !defined(_STLP_NO_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT)
357# if defined (_STLP_LONG_LONG)
363# if !defined (_STLP_NO_LONG_DOUBLE)
366# undef _STLP_DECLARE_COPY_TRIVIAL
372#if !defined (_STLP_NO_EXTENSIONS)
375template <
class _InputIter,
class _Size,
class _OutputIter>
379 for ( ; __count > 0; --__count) {
380 *__result = *__first;
384 return _STLP_STD::pair<_InputIter, _OutputIter>(__first, __result);
387template <
class _RAIter,
class _Size,
class _OutputIter>
388inline _STLP_STD::pair<_RAIter, _OutputIter>
391 _RAIter
__last = __first + __count;
392 return _STLP_STD::pair<_RAIter, _OutputIter>(
__last, _STLP_STD::copy(__first,
__last, __result));
397template <
class _InputIter,
class _Size,
class _OutputIter>
409template <
class _ForwardIter,
class _Tp>
412 for ( ; __first !=
__last; ++__first)
416template <
class _ForwardIter,
class _Tp,
class _Distance>
422#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
423template <
class _ForwardIter,
class _Tp,
class _Distance>
430template <
class _ForwardIter,
class _Tp,
class _Distance>
438template <
class _RandomAccessIter,
class _Tp,
class _Distance>
448template <
class _ForwardIter,
class _Tp>
457inline void fill(
unsigned char* __first,
unsigned char*
__last,
458 const unsigned char&
__val) {
459 unsigned char __tmp =
__val;
462#if !defined (_STLP_NO_SIGNED_BUILTINS)
464 const signed char&
__val) {
465 signed char __tmp =
__val;
476template <
class _OutputIter,
class _Size,
class _Tp>
480 for ( ;
__n > 0; --
__n, ++__first)
485#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
486template <
class _Size>
488 const unsigned char&
__val) {
489 _STLP_STD::fill(__first, __first +
__n,
__val);
490 return __first +
__n;
492#if !defined (_STLP_NO_SIGNED_BUILTINS)
493template <
class _Size>
495 const signed char&
__val) {
496 _STLP_STD::fill(__first, __first +
__n,
__val);
497 return __first +
__n;
500template <
class _Size>
503 _STLP_STD::fill(__first, __first +
__n,
__val);
504 return __first +
__n;
510template <
class _OutputIter,
class _Size,
class _Tp>
520template <
class _InputIter1,
class _InputIter2>
522_STLP_STD::pair<_InputIter1, _InputIter2>
mismatch(_InputIter1 __first1,
524 _InputIter2 __first2) {
527 while (__first1 != __last1 && *__first1 == *__first2) {
531 return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2);
534template <
class _InputIter1,
class _InputIter2,
class _BinaryPredicate>
536_STLP_STD::pair<_InputIter1, _InputIter2>
mismatch(_InputIter1 __first1,
538 _InputIter2 __first2,
539 _BinaryPredicate __binary_pred) {
542 while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
546 return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2);
549template <
class _InputIter1,
class _InputIter2>
551bool equal(_InputIter1 __first1, _InputIter1 __last1,
552 _InputIter2 __first2) {
555 for ( ; __first1 != __last1; ++__first1, ++__first2)
556 if (!(*__first1 == *__first2))
561template <
class _InputIter1,
class _InputIter2,
class _BinaryPredicate>
563bool equal(_InputIter1 __first1, _InputIter1 __last1,
564 _InputIter2 __first2, _BinaryPredicate __binary_pred) {
567 for ( ; __first1 != __last1; ++__first1, ++__first2)
568 if (!__binary_pred(*__first1, *__first2))
577template <
class _InputIter1,
class _InputIter2>
579 _InputIter2 __first2, _InputIter2 __last2);
581template <
class _InputIter1,
class _InputIter2,
class _Compare>
583 _InputIter2 __first2, _InputIter2 __last2,
588 const unsigned char* __last1,
589 const unsigned char* __first2,
590 const unsigned char* __last2) {
591 const size_t __len1 = __last1 - __first1;
592 const size_t __len2 = __last2 - __first2;
596 const int __result =
memcmp(__first1, __first2, (
min) (__len1, __len2));
597 return __result != 0 ? (__result < 0) : (__len1 < __len2);
601#if !(CHAR_MAX == SCHAR_MAX)
603 const char* __first2,
const char* __last2) {
608 (
const unsigned char*) __last1,
609 (
const unsigned char*) __first2,
610 (
const unsigned char*) __last2);
616template <
class _InputIter1,
class _InputIter2>
618 _InputIter2 __first2, _InputIter2 __last2);
622 const unsigned char* __last1,
623 const unsigned char* __first2,
624 const unsigned char* __last2) {
625 const ptrdiff_t __len1 = __last1 - __first1;
626 const ptrdiff_t __len2 = __last2 - __first2;
627 const int __result =
memcmp(__first1, __first2, (
min) (__len1, __len2));
628 return __result != 0 ? __result
629 : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
633#if !(CHAR_MAX == SCHAR_MAX)
636 const char* __first2,
const char* __last2) {
638 (
const unsigned char*) __last1,
639 (
const unsigned char*) __first2,
640 (
const unsigned char*) __last2);
646#if !defined (_STLP_NO_EXTENSIONS)
647template <
class _InputIter1,
class _InputIter2>
649 _InputIter2 __first2, _InputIter2 __last2);
654template <
class _InputIter,
class _Tp>
659 for ( ; __first !=
__last; ++__first)
660 if (*__first ==
__val)
666template <
class _InputIter,
class _Tp>
667_InputIter
find(_InputIter __first, _InputIter
__last,
const _Tp&
__val);
669template <
class _InputIter,
class _Predicate>
673template <
class _ForwardIter1,
class _ForwardIter2,
class _BinaryPred>
674_ForwardIter1
search(_ForwardIter1 __first1, _ForwardIter1 __last1,
675 _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate);
680template <
class _InputIter,
class _ForwardIter>
682 _ForwardIter __first2, _ForwardIter __last2);
684template <
class _InputIter,
class _ForwardIter,
class _BinaryPredicate>
686 _ForwardIter __first2, _ForwardIter __last2,
687 _BinaryPredicate __comp);
691template <
class _ForwardIter1,
class _ForwardIter2,
692 class _BinaryPredicate>
694find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
695 _ForwardIter2 __first2, _ForwardIter2 __last2,
696 _BinaryPredicate __comp);
699template <
class _ForwardIter,
class _Tp>
702 const _Tp& __old_value,
const _Tp& __new_value) {
704 for ( ; __first !=
__last; ++__first)
705 if (*__first == __old_value)
706 *__first = __new_value;
711template <
class _ForwardIter,
class _Tp,
class _Compare1,
class _Compare2,
class _Distance>
713 const _Tp&
__val, _Compare1 __comp1, _Compare2 __comp2, _Distance*);
719#if !defined (_STLP_LINK_TIME_INSTANTIATION)
#define random_access_iterator_tag
_STLP_INLINE_LOOP _InputIter _Predicate __pred
void __iter_swap_aux(_ForwardIter1 &__i1, _ForwardIter2 &__i2, const __true_type &)
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
_OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type &)
_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate)
_BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first, _BidirectionalIter1 __last, _BidirectionalIter2 __result, const bidirectional_iterator_tag &, _Distance *)
_STLP_MOVE_TO_STD_NAMESPACE int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2)
_STLP_MOVE_TO_PRIV_NAMESPACE _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type &)
#define _STLP_DECLARE_COPY_TRIVIAL(_Tp)
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result)
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2)
_STLP_INLINE_LOOP _InputIter __last
_STLP_MOVE_TO_PRIV_NAMESPACE _OutputIter __copy(_InputIter __first, _InputIter __last, _OutputIter __result, const input_iterator_tag &, _Distance *)
_STLP_MOVE_TO_PRIV_NAMESPACE _STLP_INLINE_LOOP void __fill_fwd(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val, const input_iterator_tag &, _Distance *)
_STLP_INLINE_LOOP _STLP_STD::pair< _InputIter1, _InputIter2 > mismatch(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2)
void * __copy_trivial(const void *__first, const void *__last, void *__result)
_STLP_MOVE_TO_STD_NAMESPACE _OutputIter copy_backward(_InputIter __first, _InputIter __last, _OutputIter __result)
_OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __true_type &)
_InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred)
void * __copy_trivial_backward(const void *__first, const void *__last, void *__result)
_STLP_MOVE_TO_PRIV_NAMESPACE void __iter_swap_aux_aux(_ForwardIter1 &__i1, _ForwardIter2 &__i2, _Value *)
_STLP_MOVE_TO_PRIV_NAMESPACE _InputIter __find_first_of(_InputIter __first1, _InputIter __last1, _ForwardIter __first2, _ForwardIter __last2)
_STLP_MOVE_TO_STD_NAMESPACE _ForwardIter1 find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPredicate __comp)
_OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type &)
_STLP_MOVE_TO_STD_NAMESPACE void fill_n(_OutputIter __first, _Size __n, const _Tp &__val)
_STLP_MOVE_TO_STD_NAMESPACE void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2)
_STLP_INLINE_LOOP void replace(_ForwardIter __first, _ForwardIter __last, const _Tp &__old_value, const _Tp &__new_value)
_STLP_MOVE_TO_PRIV_NAMESPACE int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2)
_STLP_INLINE_LOOP _InputIter const _Tp & __val
_STLP_MOVE_TO_PRIV_NAMESPACE _STLP_INLINE_LOOP _OutputIter __fill_n(_OutputIter __first, _Size __n, const _Tp &__val)
_STLP_MOVE_TO_PRIV_NAMESPACE _ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp &__val, _Compare1 __comp1, _Compare2 __comp2, _Distance *)
_STLP_MOVE_TO_PRIV_NAMESPACE _STLP_INLINE_LOOP _STLP_STD::pair< _InputIter, _OutputIter > __copy_n(_InputIter __first, _Size __count, _OutputIter __result, const input_iterator_tag &)
_STLP_MOVE_TO_STD_NAMESPACE pair< _InputIter, _OutputIter > copy_n(_InputIter __first, _Size __count, _OutputIter __result)
#define _STLP_DEBUG_CHECK(expr)
#define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp)
#define _STLP_DIFFERENCE_TYPE(_Iterator)
#define _STLP_VALUE_TYPE(_It, _Tp)
#define _STLP_ITERATOR_CATEGORY(_It, _Tp)
#define _STLP_DISTANCE_TYPE(_It, _Tp)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
__kernel_ptrdiff_t ptrdiff_t
#define _STLP_INLINE_LOOP
#define _STLP_MOVE_TO_STD_NAMESPACE
#define __STATIC_CAST(__x, __y)
#define _STLP_FIX_LITERAL_BUG(__x)
#define _STLP_BEGIN_NAMESPACE
#define _STLP_END_NAMESPACE
#define _STLP_MOVE_TO_PRIV_NAMESPACE
GLuint GLuint GLsizei count
_Check_return_ _Ret_maybenull_ _In_ size_t _In_ size_t _Size
#define memmove(s1, s2, n)
_OKToSwap< _Tp1, _Tp2, _IsRef1, _IsRef2 > _IsOKToSwap(_Tp1 *, _Tp2 *, const _IsRef1 &, const _IsRef2 &)
_TrivialCopy< _Src, _Dst > _UseTrivialCopy(_Src *, _Dst *)