GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Bugs, Fixes, Releases » std::map not treated properly
std::map not treated properly [message #7709] Wed, 21 January 2009 14:51 Go to previous message
Bertram Kopf is currently offline  Bertram Kopf
Messages: 110
Registered: March 2006
continuous participant
From: *
Dear all,
I took a brief look over the code and I noticed that the usage of the std::map(s) are partly not treated in a correct way. In particular maps which contains pointers as a key are used without any compare operators.

Here are just two examples:

in recotasks/TrackFitStatTask.cxx: "std::map<CbmMCTrack*,int> mctruthmap;"

in emc/EmcData/PndEmcDigi.cxx: "std::map<PndEmcTwoCoordIndex*, PndEmcXtal*> ..."

In these cases the map uses the actual pointer values for the sorting. This results in a randomly ordered map which is in addition very error prone. It's also not possible to decide that two key pointers containing exactly the same thing are equal.
Therefore I would propose to define a base class/structure as a template which defines such "less" comparisons. In addition each key object has to have a "less" operator.

Best regards,
Read Message
Read Message
Read Message
Previous Topic: PndHypHit build error
Next Topic: G4MagIntegratorDriver error
Goto Forum:

Current Time: Mon Jul 15 03:45:58 CEST 2024

Total time taken to generate the page: 0.00705 seconds