, ,

In C++, most of the programmers use map to store elements formed by a combination of a key value and a mapped value, following a specific order.

But for some cases, I needed an unsorted map. I am explaining.

I have some data,of string type such as date, account number, account name, balance, debit amount, credit amount etc. All are key values here. I have to store values associated with these.

Problem is, map is sorting my data. that is account name, account number, balance, date order. I am not getting data in my inserted order.

So, How did I solve this problem?

I used.

struct Cell
string keyValue;
string data;

vector<Cell> cells;

One of the most benefits is, vector is faster than map.