Skip to content

[CXX-2625] Bring our own make_unique #1028

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

Merged
merged 5 commits into from
Oct 20, 2023

Conversation

vector-of-bool
Copy link
Contributor

@vector-of-bool vector-of-bool commented Sep 29, 2023

Refer: CXX-2625. This changeset replaces our use of boost's make_unique with our own implementation. This also includes some aside changes related to CMake target scripting.

@vector-of-bool vector-of-bool changed the title Bring our own make_unique [CXX-2625] Bring our own make_unique Oct 11, 2023
@vector-of-bool vector-of-bool marked this pull request as ready for review October 11, 2023 18:45
Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

Impressive. LGTM.


TEST_CASE("Create a unique_ptr") {
auto ptr = bsoncxx::stdx::make_unique<int>(12);
CHECKED_IF(ptr) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
CHECKED_IF(ptr) {
CHECK(ptr);
CHECKED_IF(ptr) {

Suggest checking ptr since CHECKED_IF only enters block if the expression evaluates to true.

Suggestion applies to other CHECKED_IF statements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was going to say that this is desired behavior, but I double-checked the docs and

CHECKED_X macros were changed to not count as failure in Catch2 3.0.1.

😐

As someone that has used these macros heavily across dozens projects for several years and seems to have missed this release note, this is an extremely breaking change from Catch2, and there doesn't appear to be a viable alternative?? It seems that I have a lot of tests to go and fix now. I need to go lay down.

* the length of the array to allocate.
*
* Requires:
* - T must be value-initializable
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* - T must be value-initializable
* - T must be default-initializable

Copy link
Contributor

@kkloberdanz kkloberdanz left a comment

Choose a reason for hiding this comment

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

Awesome!

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.

4 participants