C++怎么使用unique_ptr<widget>&作参数
1、unique_ptr&的介绍
unique_ptr
2、unique_ptr&使用参数的优势
使用unique_ptr
3、使用unique_ptr&作参数的示例
下面是一个使用unique_ptr
#include
#include
class widget
{
public:
widget(){}
~widget(){}
void show(){std::cout << "show widget" << std::endl;}
};
void func(std::unique_ptr& pw)
{
pw->show();
}
int main()
{
std::unique_ptr pw(new widget);
func(pw);
return 0;
} 从上面的代码可以看出,使用unique_ptr
上一篇
Git版本思路是什么 下一篇
Java选择排序方法是什么 猜您想看
-
AopContext.currentProxy()如何解决cache不生效问题
问题背景在Sp...
2023年07月20日 -
java常见RGB格式有哪些
常见RGB格式...
2023年07月22日 -
Goland如何安装与配置
1. 下载和...
2023年07月23日 -
如何设置 LEDE 路由器无线信号强度?
LEDE路由器...
2023年04月17日 -
基于CDP7.1.3的Spark3.0有什么特性
1. Spar...
2023年07月23日 -
怎样在MSP432-LaunchPad上运行MicroPython
准备工作在MS...
2023年07月04日