相关疑难解决方法(0)

在性能方面使用std :: memcpy()或std :: copy()会更好吗?

memcpy如下所示使用它是否更好,或者std::copy()在性能方面更好用?为什么?

char *bits = NULL;
...

bits = new (std::nothrow) char[((int *) copyMe->bits)[0]];
if (bits == NULL)
{
    cout << "ERROR Not enough memory.\n";
    exit(1);
}

memcpy (bits, copyMe->bits, ((int *) copyMe->bits)[0]);
Run Code Online (Sandbox Code Playgroud)

c++ optimization performance

154
推荐指数
5
解决办法
11万
查看次数

标签 统计

c++ ×1

optimization ×1

performance ×1