GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Bugs, Fixes, Releases » std::map not treated properly
Re: std::map not treated properly [message #7742 is a reply to message #7709] Fri, 23 January 2009 14:22 Go to previous messageGo to previous message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hallo Bertram,

Theoretically and in principle you are right that when std::map is used with pointers as keys the less operator should be implemented! and usually this is what you read in any STL book with the example of const char pointer and two pointer pointing to the same set of character and then the MAP can not decide it self which one is bigger! but here this is completely meaningless and will never introduce errors unless some body come to the idea to compare two tracks (e.g if (CbmMCTrack *t1 < CbmMCTrack *t2 ) ) what ever this comparison means!

and even if we try to implement this less operator what does it mean here how can a track be less or larger than another?

I think the important thing here is the IsEqual, but this we have as we inherits from TObject so I will not see this as a big problem but as something good to know!

another thing which I do not understand is how to solve this with a template? with a base class that define these operator maybe! but template?

My suggestion is to try to use TMAP from root instead of STL MAP, it is at least faster and then you are always sure that TObjects are inside so you do not care much about this!


regards

Mohammad
 
Read Message
Read Message
Read Message
Previous Topic: PndHypHit build error
Next Topic: G4MagIntegratorDriver error
Goto Forum:
  


Current Time: Fri Apr 19 11:08:24 CEST 2024

Total time taken to generate the page: 0.01139 seconds