![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++ algorithm
nuoshueihe
这个作者很懒,什么都没留下…
展开
-
Binary search (operating on sorted ranges):
std::lower_bound" style="margin:0px; float:right; font-family:monospace; position:relative; top:-20px">template ForwardIterator lower_bound ( ForwardIterator first, ForwardIterator last,原创 2012-12-05 15:58:58 · 430 阅读 · 0 评论 -
Modifying sequence operations:
std::copy" style="margin:0px; float:right; font-family:monospace; position:relative; top:-20px">template OutputIterator copy ( InputIterator first, InputIterator last, OutputIterator result原创 2012-12-05 15:41:04 · 469 阅读 · 0 评论 -
partial_sort instance
#include #include #include #include using namespace std;void print(vector& vec){ vector::iterator it; for(it=vec.begin();it!=vec.end();it++) { cout << *i原创 2012-12-06 10:41:34 · 347 阅读 · 0 评论 -
Min/max:
std::min" style="margin:0px; float:right; font-family:monospace; position:relative; top:-20px">template const T& min ( const T& a, const T& b );template const T& min ( const T& a, const T原创 2012-12-05 16:05:41 · 395 阅读 · 0 评论 -
Sorting:
std::sort" style="margin:0px; float:right; font-family:monospace; position:relative; top:-20px">template void sort ( RandomAccessIterator first, RandomAccessIterator last );template vo原创 2012-12-05 15:51:11 · 477 阅读 · 0 评论 -
Non-modifying sequence operations
function templatestd::for_each" style="margin:0px; float:right; font-family:monospace; position:relative; top:-20px">template Function for_each (InputIterator first, InputIterator last原创 2012-12-05 15:17:29 · 536 阅读 · 0 评论 -
sort instance
#include #include #include #include using namespace std;void print(vector& vec){ vector::iterator it; for(it=vec.begin();it!=vec.end();it++) { cout << *i原创 2012-12-06 10:10:56 · 409 阅读 · 0 评论 -
for_each
#include #include #include #include using namespace std;void output(int i){ cout << "i= " << i << "\t";}class stroutput{ public: void operator()(int i ) {原创 2012-12-05 16:52:40 · 347 阅读 · 0 评论 -
stable_sort instance
// stable_sort example#include #include #include using namespace std;bool compare_as_ints (double i,double j){ return (int(i)int(j));}int main () { double mydoubles[] = {3.14, 1.41, 2.72原创 2012-12-06 10:24:21 · 337 阅读 · 0 评论 -
typeinfo instance
// type_info example#include #include using namespace std;struct Base {};struct Derived : Base {};struct Poly_Base {virtual void Member(){}};struct Poly_Derived: Poly_Base {};int main() {原创 2012-12-06 10:57:26 · 366 阅读 · 0 评论