Skip to content
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

Discuss optional #55

Merged
merged 2 commits into from
Sep 26, 2023
Merged

Discuss optional #55

merged 2 commits into from
Sep 26, 2023

Conversation

jbcoe
Copy link
Owner

@jbcoe jbcoe commented Sep 25, 2023

No description provided.

@jbcoe jbcoe requested a review from Twon September 25, 2023 21:50
@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (f1cf198) 96.29% compared to head (bf70ada) 96.29%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #55   +/-   ##
=======================================
  Coverage   96.29%   96.29%           
=======================================
  Files           4        4           
  Lines         567      567           
=======================================
  Hits          546      546           
  Misses         21       21           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Note: As the null state of `indirect` and `polymorphic` is not observable, and
access to a moved from object is erroneous, `std::optional` can be specialized
by implementers to exchange pointers on move construction and assignment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps worth mentioning that if specialised then optional<indirect<T>> or optional<polymorphic<T>> would incur no performance penalties.

Also a reference on other languages doing the same for nullable types: https://borretti.me/article/type-systems-memory-safety#option

Copy link
Collaborator

@Twon Twon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useful clarification

@Twon Twon merged commit 81c2da1 into main Sep 26, 2023
16 checks passed
@jbcoe jbcoe deleted the dev-jbcoe-discuss-optional branch October 29, 2023 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants