-
Notifications
You must be signed in to change notification settings - Fork 321
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
Improvements and fixes for C++ nullable implementation and reduce dynamic allocation #174
Conversation
Hi @glenfe, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! The agreement was validated by Microsoft and real humans are currently evaluating your PR. TTYL, MSBOT; |
The space saving is actually more than just 1 byte. That is, the empty base optimization there actually saves |
@@ -117,7 +118,7 @@ class nullable<T, Allocator, true> | |||
|
|||
explicit | |||
nullable(const allocator_type& alloc) | |||
: _alloc(alloc), | |||
: allocator_type(alloc), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be clearer if we used Allocator
in these ctors, as that's the name of the base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
Left some comments. Be sure to look at the comments on outdated diffs, because GitHub doesn't understand that reviewing individual commits is a thing. :-( |
The rationale for |
I'm not a big fan of disabling warnings. If you chose to do so, please wrap it tightly around the offending line of code; don't do it globally for the entire file or, worse yet, the entire project. Warnings really do help catch problems; a tightly-wrapped deviation (disable, then the offending line of code, then re-enable) shows the warning was investigated, determined to be benign, and silenced. |
Saves up to alignof(value_type) or alignof(pointer) bytes.
I'm a big fan of disabling stupid warnings, especially globally. It shows a sensible intolerance to a defective C++ implementation. |
|
Confirmed size reduction of I'm going to run some x86 builds myself, as these aren't part of the CI builds. |
Closes #174, "Improvements and fixes for C++ nullable implementation and reduce dynamic allocation"
Bond version 4.3.0 is now live on NuGet.org. These changes are included in that version. You'll also need to pull down the latest C++ source code as well. |
Covers points 1, 2, 3, 4, and 6 that I raised in issue #167 as well as reduce two additional dynamic allocations.