Problem 1757

Summary: logvol getName returns by value - could it return by ref?
Product: Geant4 Reporter: Thomas Kittelmann <thomas.kittelmann>
Component: geometry/volumesAssignee: Gabriele Cosmo <Gabriele.Cosmo>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P5    
Version: 10.0   
Hardware: All   
OS: All   

Description Thomas Kittelmann 2015-06-12 08:58:57 CEST
A very minor thing perhaps, but it actually bit me recently, so I thought I would ask for it to be fixed despite its tininess :-)

The thing is, while G4VPhysicalVolume returns the string name by ref...:

    inline const G4String& GetName() const;

... G4LogicalVolume returns by value:

    inline G4String GetName() const;

Could the G4LogicalVolume GetName() be made to return by ref as well? (actually, grepping for 'G4String GetName' in G4 headers I see that return by value occurs in other classes as well).

The reason it bit me is that some compilers are now switching away from copy-on-write implementations of std::string (and the fact I was careless and assumed the LV GetName() was similar to PV GetName()).

Cheers,
Thomas
Comment 1 Gabriele Cosmo 2015-06-15 11:59:35 CEST
Thanks. This will be fixed in the next version!