Generic Programming and the STL笔记2--“不改变操作对象之内容”的算法
来源:互联网 发布:javascript 进度条 编辑:程序博客网 时间:2024/05/21 19:09
1 线性查找
1.1 find
template <class InputIterator, class EqualityComparable>
InputIterator find(InputIterator first, InputIterator last, const EqualityComparable &value);
1.2 find_if
template <class InputIterator, class Predicate>
InputIterator find_if(InputIterator first, InputIterator last, Predicate pred);
1.3 adjacent_find
template <class ForwardIterator>
ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last);
template <class ForwordIterator,, class BinaryPredicate>
ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last, BinnaryPredicate bindary_pred);
1.4 find_first_of
template <class InputIterator, class ForwardIterator>
InputIterator find_first_of(InputIterator first1, InputIterator last1, ForwardIterator first2, ForwardIterator last2);
template <class InputIterator, class ForwardIterator, class BinaryPredicate>
InputIterator find_first_of(InputIterator first1, InputIterator last1, ForwardIterator first2, ForwardIterator last2, BinaryPredicate comp);
2 子序列匹配
2.1 search
template <class ForwardIterator1, class ForwardIterator2>
ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1, FowardIterator first2, ForwardIterator last2);
template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
ForwardIterator1 search(ForwardIterator1 first1, ForwardIterator1 last1, FowardIterator first2, ForwardIterator last2, BinaryPredicate binary_pred);
2.2 find_end
template <class ForwardIterator1, class ForwardIterator2>
ForwardIterator1 find_end(ForwardIterator1 first1, ForwardIterator1 last, ForwardIterator2 first2, ForwardIterator2 last2);
template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
ForwardIterator1 find_end(ForwardIterator1 first1, ForwardIterator1 last, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate binary_pred);
2.3 search_n
template <class ForwardIterator, class Integer, class T>
ForwardIterator search_n(ForwardIterator first, ForwardIterator last, Integer count, const T& value);
template <class ForwardIterator, class Integer, class T, class BinaryPredicate>
ForwardIterator search_n(ForwardIterator first, ForwardIterator last, Integer count, const T& value, BinaryPredicate binary_pred);
3 计算元素个数
3.1 count
template <class InputIterator, class EqualityComparable>
typename iterator_traits<InputIterator>::difference_type
count(InputIterator first, InputIterator last, const EqualityComparable &value);
3.2 count_if
template <class InputIterator, class Predicate>
typename iterator_traits<InputIterator>::difference_type
count_if(InputIterator first, InputIterator last, Predicate pred);
4 for_each
template <class InputIterator, class UnaryFunction>
UnaryFunction for_each(InputIterator first, InputIterator last, UnaryFunction f);
5 比较两个Ranges
5.1 equal
template <class InputIterator1, class InputIterator2>
bool equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
bool equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate binary_pred);
5.2 mismatch
template <class InputIterator1, class InputIterator2>
pair<InputIterator1, InputIterator2>
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
pair<InputIterator1, InputIterator2>
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate binary_pred);
5.3 lexicographical_compare
template <class InputIterator1, class InputIterator2>
bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
bool lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate comp);
6 最大值与最小值
6.1 min
template <class LessThanComparable>
const LessThanComparable& min(const LessThanComparable &a, const LessThanComparable &b);
template <class T, class BinaryPredicate>
const T& min(const T &a, const T &b, BinaryPredicate comp);
6.2 max
template <class LessThanComparable>
const LessThanComparable& max(const LessThanComparable &a, const LessThanComparable &b);
template <class T, class BinaryPredicate>
const T& max(const T &a, const T &b, BinaryPredicate comp);
6.3 min_element
template <class ForwardIterator>
ForwardIterator min_element(ForwardIterator first, ForwardIterator last);
template <class ForwardIterator, class BinaryPredicate>
ForwardIterator min_element(ForwardIterator first, ForwardIterator last, BinaryPredicate comp);
6.4 max_element
template <class ForwardIterator>
ForwardIterator max_element(ForwardIterator first, ForwardIterator last);
template <class ForwardIterator, class BinaryPredicate>
ForwardIterator max_element(ForwardIterator first, ForwardIterator last, BinaryPredicate comp);
- Generic Programming and the STL笔记2--“不改变操作对象之内容”的算法
- Generic Programming and the STL笔记3--“会改变操作对象之内容”的算法
- Generic Programming and the STL笔记1
- STL学习笔记(一)不改变操作对象内容的算法
- Generic Programming and the STL笔记4--排序和查找
- Generic Programming and the STL笔记5--Iterator Classes
- Generic Programming and the STL笔记6--Function Object Classes
- Generic Programming and the STL笔记7--容器类
- 《Generic Programming and the STL》读书笔记
- STL学习笔记(二) 会改变操作对象内容的算法
- Chapter 9 Templates. Generic Programming. and STL
- 读书摘要─Generic Programming and STL
- 不会改变操作对象内容的STL算法(元素查找,序列查找,统计元素个数,比较区间,找最值)
- Templates and Generic Programming
- LUA学习笔记2-Iterators and the Generic for
- 16-Templates and Generic Programming
- Effective STL笔记(1)-Programming with the STL
- Key-Value Coding (KVC) and Generic Programming
- Android 表单验证开源框架 saripaar
- php读取TXT文件(带换行、缩进)
- IO流之FileInputStream和FileOutputStream
- Android中屏蔽 电源键长按、Home键、Home长按
- MyEclipse一站式调试Maven Web项目
- Generic Programming and the STL笔记2--“不改变操作对象之内容”的算法
- The superiority of the Chinese film faced plywood
- c++头文件
- java.lang.RuntimeException: Exception during suite construction
- 已知函数fun(n),n为三位自然数,判断n是否为水仙花数,并调用函数,并输出!
- IO流之FileWirter和FileReader
- ORACLE数据库Exp、imp以及expdp、impdp以及对exp空表的导出问题
- 加反编译软件
- Java网络编程从入门到精通(34):读写缓冲区中的数据---使用get和put方法按顺序读写单个数据