随笔分类 - C/C++
摘要:函数名: sleep 头文件: #include <unistd.h> 功 能: 执行挂起指定的秒数 语 法: unsigned sleep(unsigned seconds); 举例: void father() { int i; for(i = 0 ;i < 3;i++) { printf("f
阅读全文
摘要:1.代码 #include <string> using namespace std; void teststr(string& str) { cout<<str<<endl; } void testint(int &a) { cout<<a<<endl; } int main() { string
阅读全文
摘要:typeid是c++的关键字,typeid操作符的返回结果是名为type_info的标准库类型的对象的引用(在头文件typeinfo中定义) ISO C++标准并没有确切定义type_info,它的确切定义编译器相关的,但是标准却规定了其实现必需提供如下四种操作: type_info类提供了publ
阅读全文
摘要:定义一个map用来演示本次的遍历: std::map<int, std::string> test; test.insert(std::make_pair(1, "Test")); test.insert(std::make_pair(2, "Product")); 方式1:利用迭代器 //1.1
阅读全文
摘要:普通指针与share_ptr的互相转换: struct test { int num; string name; }; test* pTest = new test(); std::shared_ptr<test> ptr_test = std::shared_ptr<test>(pTest); /
阅读全文
摘要:1. 基本的介绍和使用 参考菜鸟教程的相关介绍,涉及各种构造函数和其他成员函数的使用。 https://www.runoob.com/w3cnote/cpp-std-thread.html 下面这篇文章也有比较丰富的使用例子: https://blog.csdn.net/ouyangfushu/ar
阅读全文

浙公网安备 33010602011771号