-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Consider passing TString by value to TNamed ctor #15434
Comments
Nice idea! Can you open a PR for that? This is a very common case indeed, it's nice to optimize it. By the way, there are |
Yes, I could. But not before next week (I am quite busy this week).
Oh, I didn't know. Which ones do you mean? |
Note that to be effective this change would also require the addition of a move constructor in |
This looks like one: https://clang.llvm.org/extra/clang-tidy/checks/modernize/pass-by-value.html |
I think this exists already? TString::TString(TString&& s) |
Indeed. I missed it :) |
Explain what you would like to see improved and how.
The TNamed ctor currently takes TString by const reference:
Reading https://www.cppstories.com/2018/08/init-string-member/ it seems, that it would be a good idea to instead pass it by value and then use move in the ctor?
ROOT version
master
Installation method
none, just looking at the source code.
Operating system
any
Additional context
We're currently looking at improving the ctors of our classes and noticed the double construction of TString, if we don't pass as
const char*
.The text was updated successfully, but these errors were encountered: