I am having trouble understanding the error. I work with a direct map of vectors (using strings and storing row vectors):
typedef std::map<std::string, std::vector<std::string> > TRouteMarkets;
The following code (stripped down),
void CFoo::Bar(const char* route, const char* market)
{
TRouteMarkets::key_type key(route);
TRouteMarkets::mapped_type mapped();
TRouteMarkets::value_type pair(key, mapped);
}
produces the following error:
"Foo.cc", line 518: Error: could not find a match for std :: pair <const std :: string, std :: vector <std :: string → :: pair (const std :: string, std :: vector <std :: string> ()) needed in CFoo :: Bar (const char *, const char *).
But removing ()from the displayed, i.e.
TRouteMarkets::mapped_type mapped;
corrects the error. What for? Is an mappedempty row vector anyway?
source
share