Home » U++ Library support » U++ Core » DUMP for Maps [FEATURE REQUEST]
DUMP for Maps [FEATURE REQUEST] [message #27231] |
Tue, 06 July 2010 15:49 |
|
Hi Mirek,
Could you please add a macro that would dump ArrayMap/VectorMap including the keys? I really miss it when debugging some of my programs. If I am not mistaken, the closest thing we have now is "DUMPC(map.GetKeys());DUMPC(map);", which is far from easy to use.
Something like this in Core/diag.h would be totally sufficient:#define DUMPM(c) UPP::LockLog(), UPP::DumpMap(VppLog() << #c << ':' << UPP::EOL, (c)), UPP::UnlockLog()
template <class T>
void DumpMap(Stream& s, const T& t) {
s << LOG_BEGIN;
for(int i = 0; i < t.GetCount(); i++)
s << '[' << i << "] = ("<< t.GetKey(i) << ") " << t[i] << EOL;
s << LOG_END;
}
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Mon May 13 11:05:19 CEST 2024
Total time taken to generate the page: 0.02518 seconds
|