I need to use STL C++ map to store key value pairs. I need to store more than one data information in stl map. e.g
Need to store DataType,Data and its behavior as(in param/outparam) all in string format. But map always use key value pair
so if I store it like
std::map<map<"int","50",>"behavior">.
But always it sorts the the data on basis of keys which I dont want. If I use like ..
pair<string, pair<string,string> >;
pair<string, pair<string,string>>("int",("100","in"));
This prompts compile time error!
error C2664: 'std::pair<_Ty1,_Ty2>::pair(const std::pair<_Ty1,_Ty2> &)' : cannot convert parameter 1 from 'const char *' to 'const std::pair<_Ty1,_Ty2> &'
What should be the exact solution of the above problem?
Regards
std::multimap
what you want? – Oliver Charlesworthstd::map
, but understanding the question. And I'm inclined to think (from the little code I see) that Usman doesn't understand it either. "unsorted key-value pair" doesn't make sense. A collection can be sorted, but a single element cannot. – MSalters