次のコードで何が原因で発生しているのかわかりません。簡単に説明すると、コードはリスト要素(それぞれ整数のベクトルです)をループし、それらを順番にマップデータ構造に割り当てようとします。基本Rcppリスト入力でエラーが発生しました
// [[Rcpp::export]]
void getPathsFromList(Rcpp::List& pathsList,
std::unordered_map<int, std::vector<int> >& paths){
Rcpp::List plist(pathsList);
int p=plist.size();
for(int i=0;i<p; i++){
SEXP e = plist[i];
Rcpp::NumericVector v(e);
for(int j=0; j<v.size(); j++){
paths[i].push_back(v[j]);
}
}
}
私が得るエラーは以下の通りです:
error: no matching constructor for initialization of 'std::__1::unordered_map<int, std::__1::vector<int, std::__1::allocator<int> >, std::__1::hash<int>, std::__1::equal_to<int>, std::__1::allocator<std::__1::pair<const int, std::__1::vector<int, std::__1::allocator<int> > > > >
私はまた、明示的にint
変数に上記v[j]
を割り当てた後、ベクターにそれを押してみましたが、非常に助けをしませんでした。私は何か基本的なものが欠けているように見えます。 (私はOSXマーベリックスにしています。)
ご希望のサンプルデータを追加してください。 – coatless