Skip to content

strict_not_null for unique_ptr#1179

Merged
carsonRadtke merged 1 commit intomicrosoft:mainfrom
beinhaerter:strict_not_null
Dec 26, 2024
Merged

strict_not_null for unique_ptr#1179
carsonRadtke merged 1 commit intomicrosoft:mainfrom
beinhaerter:strict_not_null

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
Member

@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.

@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