随笔分类 -  ACM_STL函数库

摘要:map的使用方法: 1 #include <cstdio> 2 #include <map> 3 #include <string> 4 using namespace std; 5 6 int main() 7 { 8 //声明int为键,const char* 为值 9 map<int,cons 阅读全文
posted @ 2016-03-06 16:30 Vmetrio 阅读(183) 评论(0) 推荐(0)
摘要:set是维护集合的容器 1 #include <cstdio> 2 #include <set> 3 using namespace std; 4 5 int main() 6 { 7 //声明 8 set<int> s; 9 10 //插入元素 11 s.insert(1); 12 s.inser 阅读全文
posted @ 2016-03-06 16:20 Vmetrio 阅读(135) 评论(0) 推荐(0)
摘要:STL: 队列中pop完成的不是取出最顶端的元素,而是取出最低端的元素.也就是说最初放入的元素能够最先被取出(这种行为被叫做FIFO:First In First Out,即先进先出). queue:front 是用来访问最底端数据的函数. 1 #include <queue> 2 #include 阅读全文
posted @ 2016-02-27 12:09 Vmetrio 阅读(205) 评论(0) 推荐(0)
摘要:STL: pop:完成的仅仅是移除最顶端的数据.如果访问最顶端的数据,需要使用top函数(这个操作通常也被称为peek). 1 #include <stack> 2 #include <cstdio> 3 uisng namespace std; 4 5 int main() 6 { 7 stack 阅读全文
posted @ 2016-02-27 12:05 Vmetrio 阅读(161) 评论(0) 推荐(0)
摘要:题目描述 You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a 阅读全文
posted @ 2016-02-16 17:52 Vmetrio 阅读(233) 评论(0) 推荐(0)
摘要:容器的数据结构同样是采用红黑树进行管理,插入的元素健位不允许重复,所使用的节点元素的比较函数,只对元素的健值进行比较,元素的各项数据可通过健值检索出来。map容器是一种关联容器,实现了SortedAssociative Container、Sorted Associative Container和U... 阅读全文
posted @ 2015-10-13 10:07 Vmetrio 阅读(491) 评论(0) 推荐(0)
摘要:c++相比c的一个好处就是实现了很多的容器和泛型算法,使得程序员的工作得到了很大的化简。其中一个很有用的泛型容器就是string。string是一个类,是一个在STL里边实现好了的类,由于他的很多功能都已经实现好了,所以对于程序员来说,这个stl模版类是很方便的。string的初始化和定义strin... 阅读全文
posted @ 2015-10-13 09:38 Vmetrio 阅读(175) 评论(0) 推荐(0)
摘要:c++还有一个很常用的容器就是vector容器,他是数组实现的,是一种可变长的容器,在很多的时候可以简化我们的编程。可学习的链接:http://www.cnblogs.com/mr-wid/archive/2013/01/22/2871105.html使用vector需要添加头文件#include 阅读全文
posted @ 2015-10-13 09:37 Vmetrio 阅读(129) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/thisinnocence/article/details/39579647c++专门为一些容器vector以及string等设置了一种很好用的访问方法,就是迭代器。迭代器是一种类似指针的操作,迭代器支持从一个位置转换到另一个位置,以及对于对象的间接访问。使... 阅读全文
posted @ 2015-10-13 09:34 Vmetrio 阅读(211) 评论(0) 推荐(0)