Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing std::hash<String> #84

Closed
romainfrancois opened this issue Dec 1, 2013 · 0 comments · Fixed by #408
Closed

Missing std::hash<String> #84

romainfrancois opened this issue Dec 1, 2013 · 0 comments · Fixed by #408
Milestone

Comments

@romainfrancois
Copy link
Contributor

This fails because of missing std::hash<String>.

// [[Rcpp::export]]
IntegerVector matchCpp( CharacterVector x, CharacterVector table){
  // first train an unordered_map
  std::unordered_map<String,int> map ;
  for( int i=0; i<table.size(); i++){
    String s = table[i] ;
    map[s] = i +1 ;
  }

  // now lookup
  int n = x.size() ;
  IntegerVector out(n) ;
  for( int i=0; i<n; i++){
    String s = x[i] ;
    out[i] = map[s]->second ;
  }
  return out ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant