-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated TRestMetadata::GetFieldValue to allow for default value #277
base: master
Are you sure you want to change the base?
Conversation
It looks as the compilation error is related with
|
@@ -36,7 +36,7 @@ Double_t StringToDouble(std::string in); | |||
Int_t StringToInteger(std::string in); | |||
std::string IntegerToString(Int_t n, std::string format = "%d"); | |||
std::string DoubleToString(Double_t d, std::string format = "%4.2lf"); | |||
Bool_t StringToBool(std::string in); | |||
Bool_t StringToBool(const std::string& in); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compilation failure is due to this const
keyword. It makes the argument unmatched. If we think this change is necessary then we shall open a new PR to replace all the AddConverter(xxx)
with const-input methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be implemented if it's not too much work, its not high priority but using const T&
should always be used to pass non built-in types or atleast be the default option, so I think we should support it.
This PR was made to allow
TRestMetadata::GetFieldValue
to have a default value, instead of returning "Not defined".However I could not make it work, there is some problem related to reflection I could not workout, not even creating an additional function
GetFieldValueWithDefault
that did this task...I think this is necessary in order to avoid patterns like
which could be replaced by
Could anyone (probably @nkx111) @rest-for-physics/core_dev take a look please? or perhaps there is an alternative (clean) way to achieve the same? Thanks