-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Usage of special member functions #300
Comments
With |
According to cppreference this is not the case since C++11. In fact, the current C++ standard draft reads in Chapter 15.1 [class.ctor] §7:
Similarly a implicitely defined default constructor also inherits the exception specification that follow from the class-members |
Note that the proposed change does change traits behavior, e.g. https://gcc.godbolt.org/z/ek-8XZ. |
Yes the implicitely defaulted constructor indeed may change the type traits of the class. However please note that they are strictly more correct. In you example there is no reason why |
Having correct traits behavior is kind of important. Several containers optimize based on traits. Not sure its relevant in this case, but in general it's kind of important. |
THere was a internal discussion and the corresponding PRs were closed. Insofar this issue should be closed too |
- d1397431006ea1362a5914d4a90b265d0c7c6f2c Update zoneinfo files to 2024b (#300) by Bradley White <14679271+devbww@users.noreply.github.com> - 8bdbd840e97ff32e17f25db85c82589819ad3352 Fix mingw compiler error due to missing function declarat... by Biswapriyo Nath <nathbappai@gmail.com> - 6624659e01e73e41527d6b27036e9f79a556560f Add GitHub Actions CI (#299) by Derek Mauro <761129+derekmauro@users.noreply.github.com> PiperOrigin-RevId: 673451051 Change-Id: Id39f2186bbdcb802d4fc4c5e21207c6f3709c56f
Generally it is considered best practise to not declare special member functions needlessly but rather default them, e.g. the trivial default constructor
would be better declared
The same applies for the other special member functions, Greg Falcon even mentions it in his talk at CppCon2018 [https://www.youtube.com/watch?v=6ZOygaUjzjQ]. Nevertheless these special member functions are present everywhere in abseil, e.g.
abseil-cpp/absl/container/internal/common.h
Line 58 in cd86d0d
Is there a reason for that or is that just on the bottom of the list?
The text was updated successfully, but these errors were encountered: