c++-stl
peter ren
这个作者很懒,什么都没留下…
展开
-
c++智能指针:std::auto_ptr
简洁:由于 C++ 语言没有自动内存回收机制,程序员每次 new 出来的内存都要手动 delete。很容易造成内存泄漏或者多次delete崩溃。基于此问题,智能指针应运而生。 本文先来剖析标准库STL的智能指针auto_ptr.用法如下:#include <iostream>#include <string>#include <memory>using namespace std;clas原创 2015-12-14 20:23:53 · 329 阅读 · 0 评论 -
std::priority_queue
Priority queues are a type of container adaptors, specifically designed such that its first element is always the greatest of the elements it contains, according to some strict weak ordering criterion.原创 2016-01-06 11:17:51 · 329 阅读 · 0 评论 -
std::pair
This class couples together a pair of values, which may be of different types (T1 and T2). The individual values can be accessed through its public members first and second.示例:#include <utility> /原创 2016-01-06 17:43:30 · 249 阅读 · 0 评论 -
std::upper_bound
Returns an iterator pointing to the first element in the range [first,last) which compares greater than val. 定义如下:template <class ForwardIterator, class T> ForwardIterator upper_bound (ForwardIterat原创 2016-01-06 19:02:16 · 379 阅读 · 0 评论 -
std::set
set集合容器实现了红黑树(Red-Black Tree)的平衡二叉检索树的的数据结构,构造set集合的主要目的是为了快速检索。Internally, the elements in a set are always sorted following a specific strict weak ordering criterion indicated by its internal compari原创 2016-02-16 11:20:11 · 297 阅读 · 0 评论