<expected> Implement P0323R12 - #2643
Conversation
fafd5d0 to
8a7b0a1
Compare
8e2e921 to
f1f5ff1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
cc2a7b8 to
41168b7
Compare
41168b7 to
af61334
Compare
|
Have you considered empty object optimization for Empty unexpected class? |
You mean in the case |
Yes, and also |
But the second one would not benefit from any empty base class optimization as we still have to allocate the value of Also this essentially doubles the implementation size because we still have to do a lot of things. E.g. just because a type is empty does not mean its construction is trivial. So we would need to still keep a lot of the implementation. I think if the maintainers really want to one could do it but the gains seem questionable. |
2adc35e to
b6300ad
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Stephan T. Lavavej (StephanTLavavej)
left a comment
There was a problem hiding this comment.
Thanks! Video code review pending. 😸
Note to self: I still need to review <expected> starting at class expected, and the new test.cpp.
0301c1a to
c4e5abd
Compare
Thanks to cplusplus/draft#5381 , this shouldn't be marked as strengthened.
|
I've pushed one more change thanks to A. Jiang (@frederick-vs-ja)'s discovery in #2733 that cplusplus/draft#5381 has patched |
|
Alex Guteniev (@AlexGuteniev) Thanks for raising the Empty Base Class Optimization question (in #2643 (comment) etc). I agree with Michael Schellenberger Costa (@miscco) that the implementation complexity would be high and the benefits would be minimal. Specifically, only the following cases would benefit:
In these cases, we could reduce the representation from 2 bytes (empty union followed by Unlike empty allocators, empty comparators, empty function objects, etc. I think that the EBCO isn't worth the implementation complexity, throughput cost, and risk here. |
|
I'm speculatively mirroring this to the MSVC-internal repo - further changes can be pushed, but please notify me. |
"Standard Library Header Units: <expected> ICEs with Assertion failed: IsInClassDefn()"
|
I had to push an additional change to work around VSO-1543660 "Standard Library Header Units: |
Casey Carter (CaseyCarter)
left a comment
There was a problem hiding this comment.
Reviewed product code only. I'm now going to review the test code, after which I'll prepare changes for my comments if nobody has commented otherwise. (I'm trying to avoid digging through 175 comments to see if any of these have already been rejected, but I'll probably dig through anyway before I push.)
| } | ||
| } // namespace test_expected | ||
|
|
||
| void test_reinit_regression() { |
There was a problem hiding this comment.
I would have preferred to have this as part of the assignment tests but meh...
|
I have pushed a (hopefully final) commit to guard/optimize destruction as noticed by Michael Schellenberger Costa (@miscco), and to enable internal coverage for the header units test now that Cameron DaCamara (@cdacamar) has fixed the bug 🎉 🐞. |
|
Thanks for implementing this major C++23 feature - it's expected to be a popular one! 😹 😻 🎉 |
Co-authored-by: Stephan T. Lavavej <stl@microsoft.com> Co-authored-by: Casey Carter <Casey@Carter.net>
This implements
<expected>that has been added by P0323R12.I have also incorporated the changes from WG21-P2549.
I might have been a bit too strict with constraints.
Fixes #2529