09 2021 档案
摘要:1.创建多进程 一般的步骤是这样的: #include <unistd.h> //C 和 C++ 程序设计语言中提供对POSIX 操作系统API 的访问功能的标头档的名称。是Unix Standard的缩写。 pid_t fpid; //fork函数返回值 fpid = fork(); //fork
阅读全文
摘要:1.创建线程 pthread_cread(pthread_t tid, attr, (void*) pFun(void*), (void*)arg) 在新线程tid内执行指定函数pFun,参数为arg,原有线程继续往下执行; 2.结束线程 pthread_exit((void*) retValue)
阅读全文
摘要:1:递归法 vector<int> result;getValue(TreeNode* root, vector<int>& result) { if (root != nullptr) { getValue(root->left, result); result.emplace_back(root
阅读全文
摘要:1. 类的成员函数声明为const类型,在类外定义的时候,也需要添加const 2. 如果常成员函数修改了成员变量,会在编译的时候检查出来错误! 其实关于const用错的报错都是在编译阶段出现的!(大胆推测) 3. 类的对象定义为const类型之后,就只允许调用const修饰过的(常成员)函数,否则
阅读全文