文章分类 -  c++注意点

摘要:左值引用:对等式int a = 5的a的引用,如int& b = a;(const的左值引用是可以引用右值的,如const int& b = 5) 右值引用:对上面等式中的5的引用,如int&& b = 5; 注意到右指引用其实是左值,左值通过move变成右值 完美转发:经过forward转发的量是 阅读全文
posted @ 2024-04-17 23:19 铜锣湾陈昊男 阅读(4) 评论(0) 推荐(0)
摘要:#include<iostream> #include <ranges> #include <type_traits> #include <vector> #include <algorithm> #include <string> #include <queue> using namespace 阅读全文
posted @ 2024-04-14 01:53 铜锣湾陈昊男 阅读(9) 评论(0) 推荐(0)
摘要:尽量使用函数返回值来传出参数,没办法的时候使用传出参数,使用的时候一定要穿入的是指针类型,然后传出的时候要函数本地指针取地址之后传出: #include <cstdlib> #include <iostream> using namespace std; struct node{ int value 阅读全文
posted @ 2023-04-21 00:59 铜锣湾陈昊男 阅读(6) 评论(0) 推荐(0)