Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » DUMP for Maps [FEATURE REQUEST]
DUMP for Maps [FEATURE REQUEST] [message #27231] Tue, 06 July 2010 15:49 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Trim instead of TrimBoth
Next Topic: NEW: Tree<T> container
Goto Forum:
  


Current Time: Mon May 13 11:05:19 CEST 2024

Total time taken to generate the page: 0.02518 seconds