ベクトルへの参照を引数として渡したい関数があります。
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>&)>
これは、関数の引数としてベクトルへの参照を渡すことが許可されていないことを意味していると推測しています。この問題の解決策はありますか? 代わりにポインターを渡すことはできますか?