1. 数据结构 template <class T, class Sequence = vector<T> , class Compare = less<typename Sequence::value_type> > class priority_queue { public: typedef typename Sequence::value_type value_type; typedef typename Sequence::size_type size_type; typedef typename Sequence::reference reference; typedef typename Sequence::const_reference const_reference; protected: Sequence c; Compare comp; public: priority_queue() : c() {} explicit priority_queue(const Compare& x) : c(), comp(x) {} template <class InputIterator> priority_queue(InputIterator first, InputIterator last, const Compare& x) : c(first, last),
heap并不归属于STL容器组件,但是作为priority queue的底层实现 1. push_heap template <class RandomAccessIterator> inline void push_heap(RandomAccessIterator first, RandomAccessIterator last) { //此函数被调用时,新元素已经位于底部
先进先出操作,由底部容器完成所有的工作 1. 数据结构 template <class T, class Sequence = deque<T> > class queue { friend bool operator== __STL_NULL_TMPL_ARGS (const queue& x, const queue& y); friend bool operator< __STL_NULL_TMPL_ARGS (const queue& x, const queue& y); public: typedef typename Sequence::value_type value_type; typedef typename Sequence::size_type size_type; typedef typename Sequence::reference reference; typedef typename
stack所有元素进出都符合先进后出,只有stack顶端的元素才可以被外界访问 stack不提供迭代器功能,以底部容器完成所有工作 1. 数据结构 template
为应付文件、数据丢失或损坏等可能出现的意外情况,将电子计算机存储设备中的数据复制到磁带等大容量存储设备中。备份实际就是一种 “复制” 操作,备份
1. 序列容器 .1. vector vector<int>first; vector<int> second(4,100); int myints[]={1,2,3,4}; vector<int> third(myints,myints+sizeof(muints)/sizeof(int)); vector<int>fifth={1,2,3,4}; //--------------二维vector系列-----------