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]
Re: DUMP for Maps [FEATURE REQUEST] [message #27233 is a reply to message #27231] Tue, 06 July 2010 21:07 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
dolik.rce wrote on Tue, 06 July 2010 09: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


Good idea. It is there...

Mirek
 
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: Thu Jun 06 23:20:14 CEST 2024

Total time taken to generate the page: 0.01024 seconds