我有一个函数,我想将向量的引用作为参数传递。
void function(std::vector<double>& datavector)
{
}
man 函数如下所示:
int main(int argn, char** argv)
{
    // Create a vector containing 12 variables
    std::vector<double> data;
    for(uint32_t i = 0x0; i < 0xC; i ++) data.push_back(i % 0x3);
    // Using two threads
    std::vector<std::thread> thread;
    std::vector<double> result;
    result.push_back(0.0);
    thread.push_back(std::thread(function, data));
    thread.push_back(std::thread(function, data));
    // OOPS! Should have thread.join!
    thread[0].join();
    thread[1].join();
    return EXIT_SUCCESS;
}
但是当我尝试编译时,我得到了这个错误:
no type named 'type' in class std::result_of<void (*(std::vector<double>))(std::vector<double>&)>
我猜这意味着我不允许在我的函数中传递对向量的引用作为参数。这个问题有解决方案吗?我可以传递一个指针吗?