-
Notifications
You must be signed in to change notification settings - Fork 57
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
Include headers explicitly and add constructors to comply C++20 #116
Conversation
61a2494
to
37d1658
Compare
f2e7fa4
to
13609c1
Compare
13609c1
to
cf920cb
Compare
cf920cb
to
5e03122
Compare
After thinking about this I would probably change the pattern used in constructors to the following: class X {
some_type _a;
some_type _b;
X(some_type a, some_type b)
_a(std::move(a)),
_b(std::move(b)) {}
}; The reason is that with this design the user can actually decide which argument to move and which to copy. The copy is guaranteed to only happen once, so there is only the extra move per value, which seems okay to me. One reason to do this is move safety, for example if you have this code: class X {
some_type _a;
some_type _b;
X(some_type&& a, some_type&& b)
_a(a),
_b(b) {}
}; and you construct X with the same instance of some_type xxx;
X x(std::move(xxx), std::move(xxx)); What would be the content of So I would prefer the safer variant in this case. |
…efficient code but may be too verbose.
I concur with this recommendation as being the least intrusive. |
The constructor update is necessary for the project to compile in C++20 due to struct initialization rules made more strict in C++20. The header update is to reduce the implementations details (ic header includes) leak.