Solved Which container is good for below scenario mentioned.
-
I have scenario where I need to store some data where I can have
count as unique number
and each count should be associated with some data and its valueI was thinking to use map<int, map<string,string>> but since only one data and value will be associated with count will it be overkill to use map<string,string> ?
Kindly suggest
-
map<int, tuple<string, string/*, string, ... */> >
Where
map
can be astd::map
,std::unordered_map
,QMap
,QHash
or any key-value container andtuple
isstd::pair
,QPair
orstd::tuple
or even just a customstruct
-
@Ayush-Gupta
Do you want to usestd::
containers or Qt containers? -
Qt containers would be good for me
-
@Ayush-Gupta
Then you will want eitherQMap
orQHash
, as discussed in https://doc.qt.io/qt-5/qmap.html#details according to your requirements. -
map<int, tuple<string, string/*, string, ... */> >
Where
map
can be astd::map
,std::unordered_map
,QMap
,QHash
or any key-value container andtuple
isstd::pair
,QPair
orstd::tuple
or even just a customstruct