// Algorithm implementation -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004 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 2, 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.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
/*
*
* 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 stl_algo.h
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#ifndef _ALGO_H
#define _ALGO_H 1
#include <bits/stl_heap.h>
#include <bits/stl_tempbuf.h> // for _Temporary_buffer
#include <debug/debug.h>
// See concept_check.h for the __glibcxx_*_requires macros.
namespace std
{
/**
* @brief Find the median of three values.
* @param a A value.
* @param b A value.
* @param c A value.
* @return One of @p a, @p b or @p c.
*
* If @c {l,m,n} is some convolution of @p {a,b,c} such that @c l<=m<=n
* then the value returned will be @c m.
* This is an SGI extension.
* @ingroup SGIextensions
*/
template<typename _Tp>
inline const _Tp&
__median(const _Tp& __a, const _Tp& __b, const _Tp& __c)
{
// concept requirements
__glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
if (__a < __b)
if (__b < __c)
return __b;
else if (__a < __c)
return __c;
else
return __a;
else if (__a < __c)
return __a;
else if (__b < __c)
return __c;
else
return __b;
}
/**
* @brief Find the median of three values using a predicate for comparison.
* @param a A value.
* @param b A value.
* @param c A value.
* @param comp A binary predicate.
* @return One of @p a, @p b or @p c.
*
* If @c {l,m,n} is some convolution of @p {a,b,c} such that @p comp(l,m)
* and @p comp(m,n) are both true then the value returned will be @c m.
* This is an SGI extension.
* @ingroup SGIextensions
*/
template<typename _Tp, typename _Compare>
inline const _Tp&
__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp)
{
// concept requirements
__glibcxx_function_requires(_BinaryFunctionConcept<_Compare,bool,_Tp,_Tp>)
if (__comp(__a, __b))
if (__comp(__b, __c))
return __b;
else if (__comp(__a, __c))
return __c;
else
return __a;
else if (__comp(__a, __c))
return __a;
else if (__comp(__b, __c))
return __c;
else
return __b;
}
/**
* @brief Apply a function to every element of a sequence.
* @param first An input iterator.
* @param last An input iterator.
* @param f A unary function object.
* @return @p f.
*
* Applies the function object @p f to each element in the range
* @p [first,last). @p f must not modify the order of the sequence.
* If @p f has a return value it is ignored.
*/
template<typename _InputIterator, typename _Function>
_Function
for_each(_InputIterator __first, _InputIterator __last, _Function __f)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
__glibcxx_requires_valid_range(__first, __last);
for ( ; __first != __last; ++__first)
__f(*__first);
return __f;
}
/**
* @if maint
* This is an overload used by find() for the Input Iterator case.
* @endif
*/
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;
}
/**
* @if maint
* This is an overload used by find_if() for the Input Iterator case.
* @endif
*/
template<typename _InputIterator, typename _Predicate>
inline _InputIterator
find_if(_InputIterator __first, _InputIterator __last,
_Predicate __pred, input_iterator_tag)
{
while (__first != __last && !__pred(*__first))
++__first;
return __first;
}
/**
* @if maint
* This is an overload used by find() for the RAI case.
* @endif
*/
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;
}
}
/**
* @if maint
* This is an overload used by find_if() for the RAI case.
* @endif
*/
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 _
没有合适的资源?快使用搜索试试~ 我知道了~
arm-uclinux-tools.tar.gz_arm uclinux_arm- uclinux-tools_arm-ucli
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 118 浏览量
2022-09-14
15:55:09
上传
评论
收藏 35.85MB GZ 举报
温馨提示
共2000个文件
h:1812个
ver:261个
stamp:261个
arm_uclinux_tools用于安装linux的编译器
资源详情
资源评论
资源推荐
收起资源包目录
arm-uclinux-tools.tar.gz_arm uclinux_arm- uclinux-tools_arm-ucli (2000个子文件)
arm-uclinux-elf-g++.1 456KB
arm-uclinux-elf-gcc.1 456KB
arm-uclinux-elf-ld.1 88KB
arm-uclinux-elf-cpp.1 37KB
arm-uclinux-elf-as.1 37KB
arm-uclinux-elf-objcopy.1 31KB
arm-uclinux-elf-gcov.1 23KB
arm-uclinux-elf-objdump.1 21KB
arm-uclinux-elf-run.1 21KB
arm-uclinux-elf-dlltool.1 16KB
arm-uclinux-elf-ar.1 14KB
arm-uclinux-elf-nm.1 14KB
arm-uclinux-elf-strip.1 12KB
arm-uclinux-elf-windres.1 11KB
arm-uclinux-elf-readelf.1 10KB
arm-uclinux-elf-c++filt.1 8KB
arm-uclinux-elf-gdbtui.1 8KB
arm-uclinux-elf-gdb.1 8KB
arm-uclinux-elf-size.1 8KB
arm-uclinux-elf-strings.1 7KB
arm-uclinux-elf-addr2line.1 7KB
arm-uclinux-elf-nlmconv.1 7KB
arm-uclinux-elf-ranlib.1 5KB
arm-uclinux-elf-gcc-3.4.3 85KB
gfdl.7 25KB
gpl.7 24KB
fsf-funding.7 6KB
libstdc++.a 4.03MB
libstdc++.a 4.03MB
libstdc++.a 4.02MB
libstdc++.a 4.01MB
libstdc++.a 4.01MB
libstdc++.a 4MB
libstdc++.a 3.99MB
libstdc++.a 3.99MB
libstdc++.a 3.95MB
libstdc++.a 3.94MB
libstdc++.a 3.93MB
libstdc++.a 3.93MB
libc.a 727KB
libc.a 727KB
libc.a 725KB
libc.a 725KB
libc.a 714KB
libc.a 714KB
libc.a 713KB
libc.a 713KB
libc.a 699KB
libc.a 698KB
libc.a 696KB
libc.a 696KB
libiberty.a 408KB
libiberty.a 408KB
libiberty.a 406KB
libiberty.a 406KB
libiberty.a 406KB
libiberty.a 406KB
libiberty.a 404KB
libiberty.a 404KB
libiberty.a 399KB
libiberty.a 399KB
libiberty.a 398KB
libiberty.a 398KB
libsupc++.a 304KB
libsupc++.a 304KB
libsupc++.a 304KB
libsupc++.a 304KB
libsupc++.a 302KB
libsupc++.a 302KB
libsupc++.a 301KB
libsupc++.a 301KB
libsupc++.a 298KB
libsupc++.a 298KB
libsupc++.a 298KB
libsupc++.a 298KB
libarm-uclinux-elf-sim.a 260KB
libgcc.a 253KB
libgcc.a 253KB
libgcc.a 252KB
libgcc.a 252KB
libgcc.a 251KB
libgcc.a 251KB
libgcc.a 251KB
libgcc.a 251KB
libgcc.a 250KB
libgcc.a 250KB
libgcc.a 250KB
libgcc.a 250KB
libiberty.a 181KB
libm.a 161KB
libm.a 161KB
libm.a 161KB
libm.a 160KB
libm.a 156KB
libm.a 156KB
libm.a 115KB
libm.a 115KB
libm.a 114KB
libm.a 114KB
libm.a 111KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
weixin_42651887
- 粉丝: 75
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0