-
Notifications
You must be signed in to change notification settings - Fork 60
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
Revert part of #676 because there is no implicit conversion to std::string #680
Conversation
…o std::string when trying to put a parameter that can be converted to std::string, therefore it will fail with the static_assert when compiling.
inline void putParameter(const std::string& key, std::string value) { | ||
putParameter<std::string>(key, std::move(value)); |
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.
Just having the std::string
and const char*
overloads are not enough for catching all implicit conversions? I.e. bring back the std::string
overload.
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.
Without SFINAE we get an exact match with a template, only later the conversions would be considered, no?
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.
Yes, without SFINAE the template will always be preferred when the type is not exactly const char*
nor std::string
, so having both overloads is not enough.
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.
Ah right. Overload resolution is fun ;)
Also just to make sure: We have the same |
Yes, it's impossible to hit those when using frames since the ones from the Actually, having a look at it the |
BEGINRELEASENOTES
ENDRELEASENOTES
There are several parts in the stack that rely on implicit conversion (such as from
G4STring
in k4geo, for example) and #676 disallows that. Alternatively we could keep thestatic_assert
and add another template for anything that can be converted to string but I think the original implementation with the EnableIf is just cleaner. With the getters it should be fine since we are not going to be doing weird conversions (I hope) so the rest of the PR doesn't need to be reversed.