当我正在与我应该使用哪种样式的c样式函数进行交互时。vector vs unique_ptr to c style function
我打算从c函数返回后将数据存储在向量中。一个优于另一个有什么优势?
{
auto test = std::make_unique<double[]>(10);
fooCstyle(test);
}
或
{
auto test = std::vector<double>;
test.reserve(10);
fooCstyle(test);
}
什么是你要调用的函数的签名和语义? –
fooCstyle(double array [],size_t sizeOfArray); – CodeSlapper