相关疑难解决方法(0)

std :: make_unique和std :: unique_ptr之间的差异与new

是否std::make_unique有像任何效率优势std::make_shared

与手动构建相比std::unique_ptr:

std::make_unique<int>(1);         // vs
std::unique_ptr<int>(new int(1));
Run Code Online (Sandbox Code Playgroud)

c++ smart-pointers unique-ptr c++11 c++14

118
推荐指数
4
解决办法
5万
查看次数

简单的C++数组赋值

很抱歉这个问题,我一直在做Python和JS太多了,现在回到C++来分配一个数组.

怎么能比这更容易:

float* d1 = (float*)calloc(4,sizeof(float));
d1[0] = 1;
d1[1] = 2;
d1[2] = 3;
d1[3] = 4;
Run Code Online (Sandbox Code Playgroud)

我习惯了d1 = [1,2,3,4],不能把头包裹起来......

c++ c++11

1
推荐指数
1
解决办法
1358
查看次数

标签 统计

c++ ×2

c++11 ×2

c++14 ×1

smart-pointers ×1

unique-ptr ×1