I am trying to initialise a deeply nested hash which essentially has an integer key pointing to a set , where each value in set should point to another map of string and structure.
it doesn't compile with no matching function to insert.
Can you please help me in initialising the below hash,
#include <map>
#include <iostream>
#include <string>
#include <vector>
#include <set>
struct values
{
std::string a;
std::string b;
values():a("milepost"),b("dummyval"){};
values( std::string ab, std::string bc)
{
a=ab;
b=bc;
};
};
typedef std::map<std::string,values> my_waysides ;
typedef std::map <int, std::set<std::string> > groups;
typedef std::map <std::string,my_waysides> myData;
typedef std::map <std::string,my_waysides> myData;
int main(int argc, const char * argv[]) {
std::map<int, std::map< std::set<std::string>,std::map<std::string,my_waysides>> > stringStringMap;
my_waysides m_wayside1,m_wayside2,m_wayside3;
myData data1;
data1.insert( std::make_pair("7893" , m_wayside1) );
stringStringMap.insert(std::make_pair(1,std::make_pair("ET", data1)));
stringStringMap.insert(std::make_pair(1,std::make_pair("PT", data1)));
}
Thanks Tejas
Aucun commentaire:
Enregistrer un commentaire