C++14增加了make_unique,用于创建unique_ptr对象:
#include <iostream>
#include <memory>
using namespace std;
int main() {
unique_ptr<int> iPtr = make_unique<int>(8);
cout<<*iPtr<<endl; //输出:8
return 0;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)