We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The function parameters of type std::string and QString are not consistently passed, this leads to inconsistent API and related discussions1
std::string
QString
To both spare review cycles and also improve the developer experiences, we should develop guidelines suggestion which approach should be used.
This will also be helpful when refactoring existing one that has been using char* parameters.
char*
In a nutshell:
void doSomething(std::string parameter); void doSomething(QString parameter);
vs
void doSomething(const std::string& parameter); void doSomething(const QString& parameter);
Consistently using const std::string& parameter and const QString& parameter
const std::string& parameter
const QString& parameter
In addition of avoiding unnecessary copy, it also indicates that the uidName parameter will not be modified within the function.
uidName
std::move
const std::string&
As of 5e831bc, the use of std::string vs const std::string& is distributed ...
$ ack --headers "\(.+std::string \w+" --no-filename | wc -l 108 $ ack --headers "const std::string\& \w+" --no-filename | wc -l 199
const QString&
As of 5e831bc, the use of const QString& is dominant:
$ ack --headers "\(.+QString \w+" --no-filename | wc -l 47 $ ack --headers "const QString\& \w+" --no-filename | wc -l 491
https://github.com/Slicer/Slicer/pull/7616#discussion_r1510816301 ↩
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is your feature request related to a problem? Please describe.
The function parameters of type
std::string
andQString
are not consistently passed, this leads to inconsistent API and related discussions1To both spare review cycles and also improve the developer experiences, we should develop guidelines suggestion which approach should be used.
This will also be helpful when refactoring existing one that has been using
char*
parameters.In a nutshell:
vs
Describe the solution you'd like
Use of const references
Consistently using
const std::string& parameter
andconst QString& parameter
In addition of avoiding unnecessary copy, it also indicates that the
uidName
parameter will not be modified within the function.Use of pass by value with
std::move
Describe alternatives you've considered
Additional context
Use of
std::string
vsconst std::string&
As of 5e831bc, the use of
std::string
vsconst std::string&
is distributed ...Use of
QString
vsconst QString&
As of 5e831bc, the use of
const QString&
is dominant:Footnotes
https://github.com/Slicer/Slicer/pull/7616#discussion_r1510816301 ↩
The text was updated successfully, but these errors were encountered: