Problem 1757 - logvol getName returns by value - could it return by ref?
Summary: logvol getName returns by value - could it return by ref?
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/volumes (show other problems)
Version: 10.0
Hardware: All All
: P5 enhancement
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2015-06-12 08:58 CEST by Thomas Kittelmann
Modified: 2015-06-15 11:59 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
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!