K
Kristofer Pettijohn
Greetings,
I have a 2D hash_map, defined as follows:
typedef hash_map<const char*,
str_session,
hash<const char*>,
eqstr> t_hashchar;
typedef hash_map<const char*,
t_hashchar,
hash<const char*>,
eqstr> t_hashcharchar;
so it is hash[const char*][const char*] = str_session
(in the context used, its hash["username"]["sessionid"] = str_session)
I am attempting to write an outer loop that iterates through the
username's, and an inner loop that iterates through the session id's
for that username.
The code that I have doing this is as follows:
void results(t_hashcharchar &h) {
t_hashcharchar::iterator x;
t_hashchar::iterator y;
for (x = h.begin(); x != h.end(); x++) {
for (y = x->begin(); y != x->end(); y++) {
// do stuff
}
}
}
but gives me compilation errors.
I'm either (more than likely) not understanding something properly, or
am missing something blatently obvious.
Could someone please help point out the obvious to me, or guide me towards
finding a way to do this?
Thanks!
Kristofer
I have a 2D hash_map, defined as follows:
typedef hash_map<const char*,
str_session,
hash<const char*>,
eqstr> t_hashchar;
typedef hash_map<const char*,
t_hashchar,
hash<const char*>,
eqstr> t_hashcharchar;
so it is hash[const char*][const char*] = str_session
(in the context used, its hash["username"]["sessionid"] = str_session)
I am attempting to write an outer loop that iterates through the
username's, and an inner loop that iterates through the session id's
for that username.
The code that I have doing this is as follows:
void results(t_hashcharchar &h) {
t_hashcharchar::iterator x;
t_hashchar::iterator y;
for (x = h.begin(); x != h.end(); x++) {
for (y = x->begin(); y != x->end(); y++) {
// do stuff
}
}
}
but gives me compilation errors.
I'm either (more than likely) not understanding something properly, or
am missing something blatently obvious.
Could someone please help point out the obvious to me, or guide me towards
finding a way to do this?
Thanks!
Kristofer