摘要: #include <stdio.h> union { short value; // 2字节 char bytes[sizeof(short)]; // char[2] } test; int main(int argc, const char * argv[]) { test.value = 0x 阅读全文
posted @ 2022-06-05 22:43 OXYGEN1 阅读(24) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main(int argc,char *argv[]) { int srcfd = o 阅读全文
posted @ 2022-06-02 17:37 OXYGEN1 阅读(61) 评论(0) 推荐(0)
摘要: https://blog.csdn.net/qq_52433890/article/details/121502538 阅读全文
posted @ 2022-05-31 11:26 OXYGEN1 阅读(16) 评论(0) 推荐(0)
摘要: 右值引用与移动语义使得容器的效率有了大幅提升。 如果传入的为临时变量,自动识别为右值。(下面的类A中没有指针成员变量,没有体现移动构造函数的好处,只是为了演示过程) #include <iostream> #include <vector> using namespace std; class A{ 阅读全文
posted @ 2022-05-29 17:11 OXYGEN1 阅读(33) 评论(0) 推荐(0)
摘要: default_random_engine e(time(nullptr)); uniform_int_distribution<unsigned> u(0,9); for (int i = 0;i<10; i++) { cout << u(e) << " "; } 阅读全文
posted @ 2022-05-21 19:18 OXYGEN1 阅读(34) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; void print() {} template<typename Type, typename... Types> void print(Type firstArg, Types ...args) { cout << 阅读全文
posted @ 2022-05-16 14:14 OXYGEN1 阅读(19) 评论(0) 推荐(0)
摘要: //缩小数据范围的暴力算法 bool isPrime(int x) { bool isPrime = true; if (x == 1 || (x%2 == 0 && x != 2)) { isPrime = false; } for (int i = 3; i <= sqrt(x); i+=2) 阅读全文
posted @ 2022-04-18 17:10 OXYGEN1 阅读(17) 评论(0) 推荐(0)
摘要: 教材P203 #include <iostream> #include <vector> #include <numeric> using namespace std; //numeric头文件中accumulate的源码: //template <class InIt, class T,class 阅读全文
posted @ 2022-03-15 14:29 OXYGEN1 阅读(30) 评论(0) 推荐(0)
摘要: 1、mac上传文件到linux服务器 scp 文件名 用户名@服务器ip:目标路径如:scp -P端口号 /Users/test/testFile test@xxx.xxx.xxx.xxx:/test/ 2、mac上传文件夹到linux服务器,与上传文件相比多加了-r scp -r 文件夹目录 用户 阅读全文
posted @ 2022-01-18 15:55 OXYGEN1 阅读(43) 评论(0) 推荐(0)
摘要: 1,安装mysql 2,在终端加入环境路径 如果是bash,执行open ~/.bash_profile;如果是zsh,执行open ~/.zshrc(若提醒无文件,可在对应目录下用touch命令创建文件即可) 添加语句PATH=$PATH:/usr/local/mysql/bin,保存 立即生效: 阅读全文
posted @ 2022-01-12 23:47 OXYGEN1 阅读(71) 评论(0) 推荐(0)