Message: G4GenericMessenger (G4AnyMethod) does not accept const methods Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea G4GenericMessenger (G4AnyMethod) does not accept const methods 

Forum: User Requirements
Date: 23 Nov, 2015
From: Jan Pipek <Jan Pipek>

[I am sorry, I wanted to post this message in the user interface category, but for some reason hypernews log me out whenever I want to get there. Anyway, this is also a user requirement...]


I recently found the usefulness of the G4GenericMessenger class that already helped me to reduce many lines of code and put the UI commands close to methods they invoke. However...

If I try to invoke methods that are const, compiler objects that there is no conversion from const method to non-const method:
error: no matching function for call to ‘G4GenericMessenger::DeclareMethod(const char [5], void (g4::ComponentManager::*)() const)’
     _messenger.DeclareMethod("list", &ComponentManager::ListComponents);
note:   no known conversion for argument 2 from ‘void (g4::ComponentManager::*)() const’ to ‘const G4AnyMethod&’

If I drop the keyword const, the code is compiled without any problem.

So my question/request is: would it be possible to add G4AnyMethod constructor also for const methods?


Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 More: Re: G4GenericMessenger (G4AnyMethod) does not accept const methods   (Jan Pipek - 23 Nov, 2015)
 Add Message Add Message
to: "G4GenericMessenger (G4AnyMethod) does not accept const methods"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]