// Algorithm implementation -*- C++ -*-
// 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/** @file bits/stl_algo.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{algorithm}
*/
#ifndef _STL_ALGO_H
#define _STL_ALGO_H 1
#include <cstdlib> // for rand
#include <bits/algorithmfwd.h>
#include <bits/stl_heap.h>
#include <bits/stl_tempbuf.h> // for _Temporary_buffer
#if __cplusplus >= 201103L
#include <random> // for std::uniform_int_distribution
#include <functional> // for std::bind
#endif
// See concept_check.h for the __glibcxx_*_requires macros.
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Swaps the median value of *__a, *__b and *__c to *__result
template<typename _Iterator>
void
__move_median_to_first(_Iterator __result, _Iterator __a,
_Iterator __b, _Iterator __c)
{
// concept requirements
__glibcxx_function_requires(_LessThanComparableConcept<
typename iterator_traits<_Iterator>::value_type>)
if (*__a < *__b)
{
if (*__b < *__c)
std::iter_swap(__result, __b);
else if (*__a < *__c)
std::iter_swap(__result, __c);
else
std::iter_swap(__result, __a);
}
else if (*__a < *__c)
std::iter_swap(__result, __a);
else if (*__b < *__c)
std::iter_swap(__result, __c);
else
std::iter_swap(__result, __b);
}
/// Swaps the median value of *__a, *__b and *__c under __comp to *__result
template<typename _Iterator, typename _Compare>
void
__move_median_to_first(_Iterator __result, _Iterator __a,
_Iterator __b, _Iterator __c,
_Compare __comp)
{
// concept requirements
__glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool,
typename iterator_traits<_Iterator>::value_type,
typename iterator_traits<_Iterator>::value_type>)
if (__comp(*__a, *__b))
{
if (__comp(*__b, *__c))
std::iter_swap(__result, __b);
else if (__comp(*__a, *__c))
std::iter_swap(__result, __c);
else
std::iter_swap(__result, __a);
}
else if (__comp(*__a, *__c))
std::iter_swap(__result, __a);
else if (__comp(*__b, *__c))
std::iter_swap(__result, __c);
else
std::iter_swap(__result, __b);
}
// for_each
/// This is an overload used by find() for the Input Iterator case.
template<typename _InputIterator, typename _Tp>
inline _InputIterator
__find(_InputIterator __first, _InputIterator __last,
const _Tp& __val, input_iterator_tag)
{
while (__first != __last && !(*__first == __val))
++__first;
return __first;
}
/// This is an overload used by find_if() for the Input Iterator case.
template<typename _InputIterator, typename _Predicate>
inline _InputIterator
__find_if(_InputIterator __first, _InputIterator __last,
_Predicate __pred, input_iterator_tag)
{
while (__first != __last && !bool(__pred(*__first)))
++__first;
return __first;
}
/// This is an overload used by find() for the RAI case.
template<typename _RandomAccessIterator, typename _Tp>
_RandomAccessIterator
__find(_RandomAccessIterator __first, _RandomAccessIterator __last,
const _Tp& __val, random_access_iterator_tag)
{
typename iterator_traits<_RandomAccessIterator>::difference_type
__trip_count = (__last - __first) >> 2;
for (; __trip_count > 0; --__trip_count)
{
if (*__first == __val)
return __first;
++__first;
if (*__first == __val)
return __first;
++__first;
if (*__first == __val)
return __first;
++__first;
if (*__first == __val)
return __first;
++__first;
}
switch (__last - __first)
{
case 3:
if (*__first == __val)
return __first;
++__first;
case 2:
if (*__first == __val)
return __first;
++__first;
case 1:
if (*__first == __val)
return __first;
++__first;
case 0:
default:
return __last;
}
}
/// This is an overload used by find_if() for the RAI case.
template<typename _RandomAccessIterator, typename _Predicate>
_RandomAccessIterator
__find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Predicate __pred, random_access_iterator_tag)
{
typename iterator_traits<_RandomAccessIterator>::difference_type
__trip_count = (__last - __first) >> 2;
for (; __trip_count > 0; --__trip_count)
{
if (__pred(*__first))
return __first;
++__first;
if (__pred(*__first))
return __first;
++__first;
if (__pred(*__first))
return __first;
++__first;
if (__pred(*__first))
return __first;
++__first;
}
switch (__last - __first)
{
case 3:
if (__pred(*__first))
return __first;
++__first;
case 2:
if (__pred(*__first))
return __first;
++__first;
case 1:
if (__pred(*__first))
return __first;
++__first;
case 0:
default:
return __last;
}
}
/// This is an overload used by find_if_not() for the Input Iterator case.
template<typename _InputIterator, typename _Predicate>
inline _InputIterator
__find_if_not(_InputIterator __first, _InputIterator __last,
_Predicate __pred, input_iterator_tag)
{
while (__first != __last && bool(__pred(*__first)))
++__first;
return __first;
}
/// This is an overload used by find_if_not() for the RAI case.
template<typename _RandomAccessIterator, typename _Predicate>
_RandomAccessIterator
__find_if_not(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Predicate __pred, random_access_iterator_tag)
{
typename iterator_traits<_RandomAccessIterator>::difference_type
__trip_count = (__last - __first) >> 2;
for (; __trip_count > 0; --__trip_count)
{
if (!bool(__pred(*__first)))
return __first;
++__fir
没有合适的资源?快使用搜索试试~ 我知道了~
mipsel-linux-gcc 4.8.4 Cygwin版
共2000个文件
h:1386个
hpp:243个
mo:121个
5星 · 超过95%的资源 需积分: 46 38 下载量 76 浏览量
2015-05-16
22:16:18
上传
评论 2
收藏 30.03MB RAR 举报
温馨提示
Cygwin下的mipsel-linux-gcc交叉编译工具,版本:4.8.4
资源推荐
资源详情
资源评论
收起资源包目录
mipsel-linux-gcc 4.8.4 Cygwin版 (2000个子文件)
libmudflapth.so.0.0.0 343KB
libmudflapth.so.0.0.0 343KB
libmudflap.so.0.0.0 328KB
libgomp.so.1.0.0 257KB
libgomp.so.1.0.0 256KB
libatomic.so.1.0.0 80KB
libpthread.so.0 58B
libmudflapth.so.0 56B
libresolv.so.0 56B
libc.so.0 56B
ld-uClibc.so.0 56B
libmudflapth.so.0 56B
libcrypt.so.0 54B
libmudflap.so.0 52B
libutil.so.0 52B
libnsl.so.0 50B
libdl.so.0 48B
librt.so.0 48B
libm.so.0 46B
libgcc_s.so.1 1.44MB
libgcc_s.so.1 1.43MB
mipsel-linux-gcc.1 889KB
mipsel-linux-g++.1 889KB
mipsel-linux-ld.1 109KB
mipsel-linux-as.1 66KB
mipsel-linux-cpp.1 42KB
mipsel-linux-objcopy.1 41KB
mipsel-linux-objdump.1 31KB
mipsel-linux-gprof.1 29KB
mipsel-linux-gcov.1 26KB
mipsel-linux-dlltool.1 20KB
mipsel-linux-ar.1 18KB
mipsel-linux-nm.1 17KB
mipsel-linux-readelf.1 15KB
mipsel-linux-strip.1 13KB
mipsel-linux-windres.1 13KB
mipsel-linux-c++filt.1 11KB
mipsel-linux-windmc.1 10KB
mipsel-linux-addr2line.1 10KB
mipsel-linux-size.1 9KB
mipsel-linux-strings.1 8KB
mipsel-linux-elfedit.1 8KB
mipsel-linux-nlmconv.1 8KB
mipsel-linux-ranlib.1 6KB
libatomic.so.1 50B
libgomp.so.1 46B
libgomp.so.1 46B
libstdc++.so.6.0.19 4.04MB
libstdc++.so.6.0.19 3.95MB
libstdc++.so.6 52B
libstdc++.so.6 52B
gpl.7 42KB
fsf-funding.7 6KB
gfdl.7 10B
libstdc++.a 7.33MB
libstdc++.a 7.19MB
libgcc.a 5.76MB
libc.a 1.73MB
libiberty.a 1021KB
libsupc++.a 638KB
libmudflap.a 444KB
libmudflapth.a 396KB
libmudflapth.a 395KB
libgomp.a 374KB
libgomp.a 373KB
libpthread.a 314KB
libm.a 308KB
libatomic.a 192KB
libgcov.a 156KB
libgcc_eh.a 144KB
liblto_plugin.dll.a 54KB
librt.a 40KB
libdl.a 30KB
libcrypt.a 18KB
libutil.a 11KB
uclibc_nonshared.a 3KB
libpthread_nonshared.a 2KB
libresolv.a 2KB
libnsl.a 2KB
libpthread_nonshared_pic.a 58B
libpthread_pic.a 38B
libresolv_pic.a 36B
libcrypt_pic.a 34B
libutil_pic.a 32B
libnsl_pic.a 30B
libdl_pic.a 28B
librt_pic.a 28B
libc_pic.a 26B
libm_pic.a 26B
algorithm 19KB
algorithm 2KB
algorithm 1KB
array 9KB
array 9KB
array 8KB
array 7KB
atomic 33KB
bitset 45KB
bitset 12KB
bitset 10KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
GXCGG
- 粉丝: 11
- 资源: 33
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页