I am trying to get someGeant4 code (not mine) that worked successfully under geant4 10.2.p02 working under Geant4 11.0.2. In module RunSimulation.cc I have:
std::string::reverse_iterator dirIter = OutDir.rbegin();
if ((G4String) *dirIter != /) OutDir += /;
This is giving me a compilation error:
'/pathto/RunSimulation.cc: In function ‘int main(int, char**)’:
/pathto/RunSimulation.cc:120:25: error: no matching function for call to ‘G4String::G4String(char&)’
120 | if ((G4String) *dirIter != “/”) OutDir += “/”; ’
The code worked for Geant4 10.2.p02, but the release notes for Geant4 11.0 describe changes made to G4String. I have read Appendix 10 A1 of the release notes for Geant4 11.0 (Changes required for advanced use of G4String). However, nothing there suggests why the above code no longer works or how to fix it.
I thought that G4String inherited from std::string, so the reverse iterator construct should be OK. Alternatively, is there any need to use G4String and could I just change OutDir to a std::string?
Any help is appreciated. Thanks.