-
Notifications
You must be signed in to change notification settings - Fork 263
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
Add explicit to single-parameter constructors #28
Comments
Thanks for the suggestion! I'm not opposed to adding the |
To disallow passing an |
I'm still not convinced. Would you mind writing a short code example illustrating a case where this might be relevant? Thanks! |
It may be a silly error, but: std::uint32_t thread_cnt = 10;
thread_pool thread_pool{thread_cnt};
void f(const thread_pool& pool) {
// do something
}
f(thread_cnt); // error-prone, passed wrong parameter but still compiles
|
Okay, I see what you mean. I'll add this to my TODO list, but it will only be added when the new version is released (which will have many other changes and new features). It might take a few weeks or even months since I'm really busy these days with teaching and research. Thanks for your contribution! |
Describe the new feature
Can we add explicit to single-parameter constructors to avoid unintended implicit construct?
Code example
The text was updated successfully, but these errors were encountered: