atilaneves / automem

C++-style automatic memory management smart pointers for D
BSD 3-Clause "New" or "Revised" License
86 stars 15 forks source link

added interface support for unique including unittest for it #71

Closed vushu closed 1 year ago

vushu commented 1 year ago

I tried to tinker around with Unique and it looks like it doesn't support interfaces, so I tried adding it. I also tried to do the same for RefCounted, but had some problems.

codecov[bot] commented 1 year ago

Codecov Report

Base: 98.57% // Head: 97.06% // Decreases project coverage by -1.51% :warning:

Coverage data is based on head (24b7dbe) compared to base (87fd010). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #71 +/- ## ========================================== - Coverage 98.57% 97.06% -1.52% ========================================== Files 12 12 Lines 845 851 +6 ========================================== - Hits 833 826 -7 - Misses 12 25 +13 ``` | [Impacted Files](https://codecov.io/gh/atilaneves/automem/pull/71?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Atila+Neves) | Coverage Δ | | |---|---|---| | [source/automem/unique.d](https://codecov.io/gh/atilaneves/automem/pull/71/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Atila+Neves#diff-c291cmNlL2F1dG9tZW0vdW5pcXVlLmQ=) | `97.87% <ø> (ø)` | | | [tests/ut/unique.d](https://codecov.io/gh/atilaneves/automem/pull/71/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Atila+Neves#diff-dGVzdHMvdXQvdW5pcXVlLmQ=) | `100.00% <100.00%> (ø)` | | | [tests/ut/issues.d](https://codecov.io/gh/atilaneves/automem/pull/71/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Atila+Neves#diff-dGVzdHMvdXQvaXNzdWVzLmQ=) | `67.27% <0.00%> (-23.64%)` | :arrow_down: | | [source/automem/allocator.d](https://codecov.io/gh/atilaneves/automem/pull/71/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Atila+Neves#diff-c291cmNlL2F1dG9tZW0vYWxsb2NhdG9yLmQ=) | `100.00% <0.00%> (ø)` | | | [source/automem/utils.d](https://codecov.io/gh/atilaneves/automem/pull/71/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Atila+Neves#diff-c291cmNlL2F1dG9tZW0vdXRpbHMuZA==) | `80.00% <0.00%> (+5.00%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Atila+Neves). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Atila+Neves)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

vushu commented 1 year ago

@atilaneves good question, but it will say boom when we try to GC.removeRange(_object); for type of interface. my best guess is that interfaces can't be dynamically allocated meaning you can't newan interface, therefore we can't GC.removeRange.

vushu commented 1 year ago

I have added asserts to ensure that the class gets properly de-allocated.