polymorphic_value
polymorphic_value copied to clipboard
Make null-state non-observable
Make default constructor private. Make null-state only accessible via a move. Replace operator bool with valueless_by_move.
Docs need updating to merge this but I want to see what the API and coverage stats look like.
Codecov Report
Merging #120 (edf3ea7) into main (8f42b54) will decrease coverage by
1.26%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #120 +/- ##
==========================================
- Coverage 96.63% 95.36% -1.27%
==========================================
Files 2 2
Lines 505 410 -95
==========================================
- Hits 488 391 -97
- Misses 17 19 +2
Impacted Files | Coverage Δ | |
---|---|---|
polymorphic_value.h | 87.69% <100.00%> (-2.09%) |
:arrow_down: |
polymorphic_value_test.cpp | 98.92% <100.00%> (-0.26%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 8f42b54...edf3ea7. Read the comment docs.
There is also valueless_by_exception as in variant. I didn't think about the moved from state. This even more suggests that disallowing empty state is futile. With SBO the moved from object is still available and can be returned unless the object is larger than the SBO buffer.
We are abandoning this approach due to undesirable semantics of optional types with pointer-like interfaces.