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

strict_not_null for unique_ptr #1179

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

beinhaerter
Copy link
Contributor

@beinhaerter beinhaerter commented Dec 23, 2024

  • strict_not_null<std::unique_ptr<int>>{ std::make_unique<int>()} failed to compile
    • strict_not_null ctor needs to move the passed unique_ptr, not copy
    • Copied not_null TestNotNullConstructors for strict_not_null
  • The noexcept specifiers on the strict_not_null and not_null constructors were out of sync.
  • Added unit test for not_null<unique_ptr<T>> and for strict_not_null<unique_ptr<T>>
  • Added unit test for gsl::swap for two strict_not_null
  • Added unit test for gsl::swap for not_null and strict_not_null

@beinhaerter beinhaerter force-pushed the strict_not_null branch 2 times, most recently from 75964df to 53a1e8c Compare December 23, 2024 13:46
Copy link
Collaborator

@carsonRadtke carsonRadtke left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the issue and adding well-written tests. Everything looks good!

I will merge once the conflicts are resolved.

tests/strict_notnull_tests.cpp Show resolved Hide resolved
@carsonRadtke carsonRadtke added the Type: Bug Indicates a bug or error label Dec 23, 2024
- `strict_not_null<std::unique_ptr<int>>{ std::make_unique<int>()}` failed to compile
  - `strict_not_null` ctor needs to move the passed `unique_ptr`, not copy
  - Copied `not_null` `TestNotNullConstructors` for `strict_not_null`
- The `noexcept` specifiers on the `strict_not_null` and `not_null` constructors were out of sync.
- Added unit test for `not_null<unique_ptr<T>>` and for `strict_not_null<unique_ptr<T>>`
- Added unit test for `gsl::swap` for two `strict_not_null`
- Added unit test for `gsl::swap` for `not_null` and `strict_not_null`
@carsonRadtke carsonRadtke merged commit 16a6019 into microsoft:main Dec 26, 2024
83 checks passed
@beinhaerter beinhaerter deleted the strict_not_null branch December 28, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Indicates a bug or error
Projects
Development

Successfully merging this pull request may close these issues.

2 participants