Following up on my previous question unordered_map use in Rcpp, I wish to know if there is a way I can use multiple unique keys with multiple unique values in an unordered_map within Rcpp.
Note: the unordered_map will have two unique keys of string type and two corresponding unique values of string and double type.
Question 1: Please enlighten me if I am wrong with this multiple key-value pair concept of hash table, i.e., if it is even possible to create a hash table like that.
I am trying to do something like this: // [[Rcpp::plugins(cpp11)]]
#include <Rcpp.h>
#include <unordered_map>
#include <string>
using namespace Rcpp;
//[[Rcpp::export]]
int hash_map()
{
std::unordered_map<std::pair<std::string,std::string>,std::pair<std::string,double>> hashtable3;
return 0;
}
But it gives me the following errors:
Question 2: Do I need to take hint from this example: C++ unordered_map using a custom class type as the key, although being someone who is just starting out in Rcpp and C++, I am not sure if I can even implement this in Rcpp, given the fact that exposing C++ classes is something entirely new to me. (I say this as I tried to read through this document Exposing C++ functions and classes with Rcpp modules, and it was a little overwhelming.