Hello all,
I am having a little problem that is turning me crazy!!!
Well, I declared a hash table ht, using std::map, with a key of type
string, and content of type a vector of string:
sdt::map<string, vector<string>*> ht;
After inserting values into ht, I want to access the records. So, to
access the data I have the key and I found the its respective line in
ht. I did the following:
std::map<string, vector<string>* >::iterator temp; //temporary structure
temp = ht.find(id);
Now, I want to access the data that is inside the vector that is the
second element in my hash table. I've been trying many ways to do
this, but without success. One of the ways I tried is the following:
vector<string> data; //vector to store the data from the hash table
data.at(0) = temp->second->at(0);
It returns me an error like:
terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check
Does anybody know what could be the problem here?!
Thanks in advance for any help.
Ricardo.
|