c++
summer2day
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
set的用法
常用操作:创建: set<int> s; set<int>::iterator it;插入: insert() 可以插入单个键值,也可以插入一个容器 例如:s.insert(v.begin(),v.end());begin() 返回set容器的第一个元素 end() 返回set容器的最后一个元素大小: empty() 判断set容器是否为空 max_size()原创 2017-11-10 17:14:10 · 380 阅读 · 0 评论 -
用两个栈实现队列
题目描述 用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。 思路:栈的顺序是先进后出,队列的顺序是先进先出,所以push的操作就是正常的入栈操作,pop是先把stack1中的放到stack2中再出,即负负得正。 注意:在c++中,a=stack1.pop()这样是不对的,因为pop返回的是一个void,所以需要先取出stack1的栈顶元素a=stack1.t原创 2017-11-12 21:40:30 · 220 阅读 · 0 评论 -
谈谈C++的volatile关键字以及常见的误解
转载请保留以下声明 作者:赵宗晟 出处:https://www.cnblogs.com/zhao-zongsheng/p/9092520.html 编译器对代码的优化 在讲volatile关键字之前,先讲一下编译器的优化。 int main() { int i = 0; i++; cout << "hello world" << endl; ...转载 2019-03-25 22:50:55 · 198 阅读 · 0 评论 -
创建线程报错 undefined reference to `pthread_create'
创建线程 #include<stdio.h> #include<pthread.h> void* say_hello(void* args){ printf("hello from thread\n"); pthread_exit((void*)1); } int main(){ pthread_t tid; int iret=pthread_create(&a...原创 2019-06-29 00:07:32 · 462 阅读 · 0 评论
分享