algorithm.h中包含的函数有哪些

如题所述

这 是MSDN里给的,绝对正确,希望对您有帮助哦~~

adjacent_find (STL/CLR)

Searches for two adjacent elements that are equal.

binary_search (STL/CLR)

Tests whether a sorted sequence contains a given value.

copy (STL/CLR)

Copies values from a source range to a destination range, iterating in the forward direction.

copy_backward (STL/CLR)

Copies values from a source range to a destination range, iterating in the backward direction.

count (STL/CLR)

Returns the number of elements in a range whose values match a specified value.

count_if (STL/CLR)

Returns the number of elements in a range whose values match a specified condition.

equal (STL/CLR)

Compares two ranges, element by element.

equal_range (STL/CLR)

Searches an ordered sequence of values and returns two positions that delimit a subsequence of values that are all equal to a given element.

fill (STL/CLR)

Assigns the same new value to every element in a specified range.

fill_n (STL/CLR)

Assigns a new value to a specified number of elements in a range beginning with a particular element.

find (STL/CLR)

Returns the position of the first occurrence of a specified value.

find_end (STL/CLR)

Returns the last subsequence in a range that is identical to a specified sequence.

find_first_of (STL/CLR)

Searches a range for the first occurrence of any one of a given range of elements.

find_if (STL/CLR)

Returns the position of the first element in a sequence of values where the element satisfies a specified condition.

for_each (STL/CLR)

Applies a specified function object to each element in a sequence of values and returns the function object.

generate (STL/CLR)

Assigns the values generated by a function object to each element in a sequence of values.

generate_n (STL/CLR)

Assigns the values generated by a function object to a specified number of elements.

includes (STL/CLR)

Tests whether one sorted range contains all the elements in a second sorted range.

inplace_merge (STL/CLR)

Combines the elements from two consecutive sorted ranges into a single sorted range.

iter_swap (STL/CLR)

Exchanges two values referred to by a pair of specified iterators.

lexicographical_compare (STL/CLR)

Compares two sequences, element by element, identifying which sequence is the lesser of the two.

lower_bound (STL/CLR)

Finds the position of the first element in an ordered sequence of values that has a value greater than or equal to a specified value.

make_heap (STL/CLR)

Converts elements from a specified range into a heap where the first element on the heap is the largest.

max (STL/CLR)

Compares two objects and returns the greater of the two.

max_element (STL/CLR)

Finds the largest element in a specified sequence of values.

merge (STL/CLR)

Combines all the elements from two sorted source ranges into a single, sorted destination range.

min (STL/CLR)

Compares two objects and returns the lesser of the two.

min_element (STL/CLR)

Finds the smallest element in a specified sequence of values.

mismatch (STL/CLR)

Compares two ranges element by element and returns the first position where a difference occurs.

next_permutation (STL/CLR)

Reorders the elements in a range so that the original ordering is replaced by the lexicographically next greater permutation if it exists.

nth_element (STL/CLR)

Partitions a sequence of elements, correctly locating the nth element of the sequence so that all the elements in front of it are less than or equal to it and all the elements that follow it are greater than or equal to it.

partial_sort (STL/CLR)

Arranges a specified number of the smaller elements in a range into nondescending order.

partial_sort_copy (STL/CLR)

Copies elements from a source range into a destination range such that the elements from the source range are ordered.

partition (STL/CLR)

Arranges elements in a range such that those elements that satisfy a unary predicate precede those that fail to satisfy it.

pop_heap (STL/CLR)

Moves the largest element from the front of a heap to the end and then forms a new heap from the remaining elements.

prev_permutation (STL/CLR)

Reorders a sequence of elements so that the original ordering is replaced by the lexicographically previous greater permutation if it exists.

push_heap (STL/CLR)

Adds an element that is at the end of a range to an existing heap consisting of the prior elements in the range.

random_shuffle (STL/CLR)

Rearranges a sequence of N elements in a range into one of N! possible arrangements selected at random.

remove (STL/CLR)

Deletes a specified value from a given range without disturbing the order of the remaining elements and returns the end of a new range free of the specified value.

remove_copy (STL/CLR)

Copies elements from a source range to a destination range, except that elements of a specified value are not copied, without disturbing the order of the remaining elements.

remove_copy_if (STL/CLR)

Copies elements from a source range to a destination range, except those that satisfy a predicate, without disturbing the order of the remaining elements.

remove_if (STL/CLR)

Deletes elements that satisfy a predicate from a given range without disturbing the order of the remaining elements. .

replace (STL/CLR)

Replaces elements in a range that match a specified value with a new value.

replace_copy (STL/CLR)

Copies elements from a source range to a destination range, replacing elements that match a specified value with a new value.

replace_copy_if (STL/CLR)

Examines each element in a source range and replaces it if it satisfies a specified predicate while copying the result into a new destination range.

replace_if (STL/CLR)

Examines each element in a range and replaces it if it satisfies a specified predicate.

reverse (STL/CLR)

Reverses the order of the elements within a range.

reverse_copy (STL/CLR)

Reverses the order of the elements within a source range while copying them into a destination range.

rotate (STL/CLR)

Exchanges the elements in two adjacent ranges.

rotate_copy (STL/CLR)

Exchanges the elements in two adjacent ranges within a source range and copies the result to a destination range.

search (STL/CLR)

Searches for the first occurrence of a sequence within a target range whose elements are equal to those in a given sequence of elements or whose elements are equivalent in a sense specified by a binary predicate to the elements in the given sequence.

search_n (STL/CLR)

Searches for the first subsequence in a range that of a specified number of elements having a particular value or a relation to that value as specified by a binary predicate.

set_difference (STL/CLR)

Unites all of the elements that belong to one sorted source range, but not to a second sorted source range, into a single, sorted destination range, where the ordering criterion may be specified by a binary predicate.

set_intersection (STL/CLR)

Unites all of the elements that belong to both sorted source ranges into a single, sorted destination range, where the ordering criterion may be specified by a binary predicate.

set_symmetric_difference (STL/CLR)

Unites all of the elements that belong to one, but not both, of the sorted source ranges into a single, sorted destination range, where the ordering criterion may be specified by a binary predicate.

set_union (STL/CLR)

Unites all of the elements that belong to at least one of two sorted source ranges into a single, sorted destination range, where the ordering criterion may be specified by a binary predicate.

sort (STL/CLR)

Arranges the elements in a specified range into a nondescending order or according to an ordering criterion specified by a binary predicate.

sort_heap (STL/CLR)

Converts a heap into a sorted range.

stable_partition (STL/CLR)

Classifies elements in a range into two disjoint sets, with those elements satisfying a unary predicate preceding those that fail to satisfy it, preserving the relative order of equivalent elements.

stable_sort (STL/CLR)

Arranges the elements in a specified range into a nondescending order or according to an ordering criterion specified by a binary predicate and preserves the relative ordering of equivalent elements.

swap (STL/CLR)

Exchanges the values of the elements between two types of objects, assigning the contents of the first object to the second object and the contents of the second to the first.

swap_ranges (STL/CLR)

Exchanges the elements of one range with the elements of another, equal sized range.

transform (STL/CLR)

Applies a specified function object to each element in a source range or to a pair of elements from two source ranges and copies the return values of the function object into a destination range.

unique (STL/CLR)

Removes duplicate elements that are adjacent to each other in a specified range.

unique_copy (STL/CLR)

Copies elements from a source range into a destination range except for the duplicate elements that are adjacent to each other.

upper_bound (STL/CLR)

Finds the position of the first element in an ordered range that has a value that is greater than a specified value, where the ordering criterion may be specified by a binary predicate.追问

对函数的解释都是英文的,有没有中文的解释啊

参考资料:MSDN

温馨提示:内容为网友见解,仅供参考
第1个回答  2011-12-12
一些排序函数,如sort,stable_sort等一些系统函数,效率都很高

algorithm.h中包含的函数有哪些
我的 algorithm.h中包含的函数有哪些  我来答 2个回答 #热议# 职场上受委屈要不要为自己解释?18842640579 推荐于2016-12-01 知道答主 回答量:2 采纳率:0% 帮助的人:2.4万 我也去答题访问个人页 关注 展开全部 这是MSDN里给的,绝对正确,希望对您有帮助哦~~adjacent_find (STL\/CLR)Searc...

c语言中math.h中有没有gcd()函数?
其实是有的,但不是标准库内的函数,所谓的标准库是指:(c标准iso\/iec 9899,c++标准iso\/iec 14882)。__gcd(a,b);这是GNU内部函数。

qsort函数使用方法总结(详细全面+代码)
qsort函数是C语言中用于对数组进行排序的重要工具,它在<algorithm.h>头文件中定义。这个函数的主要功能是基于用户自定义的比较函数对数组元素进行排序,支持任意大小的元素,只要提供比较函数(*compar)即可。以下是其关键参数和使用方法的详细说明:参数说明:- base:指向数组的起始地址,通常传递数组名。-...

C++中的min和max函数的问题。。。
首先确定你的min和max是标准库<algorithm>里面的,因为Win32头文件windef.h中,也定义了min和max,而windef中的是宏,不是函数。如果是宏的话,你这么复杂的表达式嵌套就可能出现问题。如果是在Windows工程中,你可以把min和max换成_MIN和_MAX试试,这俩一般情况下代表C++库中的min和max。下来你可以...

stdlib.h里包含有max和min函数么。。。一本书上说“是的”,但是我试...
头文件 用 #include <windows.h> 也可以自己在头文件部分 #include<stdio.h> 后面 加 写宏定义:include<stdio.h> define max(a,b) (((a) > (b)) ? (a) : (b))define min(a,b) (((a) < (b)) ? (a) : (b))...

如何使用remove_if()算法
remove_if() 算法的原型如下(定义在标准头文件 algorithm.h中):templateForwardIterator remove(ForwardIterator first, ForwardIterator last,Predicate pred);前两个参数表明了序列的开始和结束。第三个参数是一个判断条件或一个函数,要求返回布尔值。与remove() 不一样的是, remove_if() 通过第三...

string.h头文件中有什么函数
string.h头文件中的函数:1、#include <algorithm> \/\/STL 通用算法 2、#include <bitset> \/\/STL 位集容器 3、#include <complex> \/\/复数类 4、#include <deque> \/\/STL双端队列容器 5、#include <exception> \/\/异常处理类 6、#include <list> \/\/STL 线性列表容器 7、#include \/\/STL 映...

C++所有头文件所包含的函数
包含函数:(函数要列举完全,不管是不是常用)void xxx()定义:作用:用法:(这三条都要有)int xxx()定义:作用:用法: 头文件:yyyy.h、包含函数:void xxx()定义:作用:用法:int xxx()定义:作用;用法: 无视要求乱答一气的请右上角。。。直接复制常用函数的也请右上角。。。网上一搜就有不用你费工夫答不全...

go语言为什么没有min\/max函数
go语言math包里面定义了min\/max函数,但是是float64类型的,而并没有整数类型的min\/max。因为go没有重载,这是个大坑。所以math库里min\/max函数都只能定义一个,所以官方选择了比较难实现的float64类型。而简单的整形就需要让程序员自己实现了

C++中min函数和max函数的头文件是什么?
C++中min函数和max函数的头文件是<algorithm>

相似回答