Skip to content

CXX-3173 Make make_unique.hpp an internal header #1265

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 4 commits into from
Nov 11, 2024

Conversation

eramongodb
Copy link
Contributor

@eramongodb eramongodb commented Nov 11, 2024

Summary

Resolves CXX-3173. Verified by this patch.

Removes bsoncxx/stdx/make_unique.hpp from public headers.

Note

The majority of diffs in this PR are updates to include directives and qualifiers.

make_unique

Since its introduction, this particular C++ polyfill has been unlike the other polyfills (optional and string_view). Despite make_unique.hpp being a public header under stdx/, it's usage has always and only ever been in implementation files, never in a public header (with the sole exception of a stray unused include directive in bsoncxx/types/bson_value/value.hpp). Its unique feature testing behavior has nevertheless managed to cause problems for users (#924) despite not being part of the API or ABI.

Given its dubious value as a public polyfill (+ existing efforts to avoid encouraging their use by users such as in #1182), this PR proposes moving this header into internal directories (alongside other for-internal-use-only private headers) to better reflect its purpose and use. The function templates are moved out of the bsoncxx::v_noabi::stdx namespace and into the bsoncxx::detail namespace for consistency with other internal interfaces and avoid confusion with public v_noabi (it is not part of the ABI) or stdx (it is not a configurable polyfill like optional or string_view) interfaces.

Note: mongocxx, test, and microbenchmark targets have visibility of private bsoncxx headers and so are not limited by the relocation of this header. That being said, given the microbenchmark target unconditionally requires C++17 or newer anyways, this PR updates its code to use std::make_unique instead.

@eramongodb eramongodb requested a review from kevinAlbs November 11, 2024 20:05
@eramongodb eramongodb self-assigned this Nov 11, 2024
@eramongodb eramongodb merged commit 6f77257 into mongodb:master Nov 11, 2024
14 of 17 checks passed
@eramongodb eramongodb deleted the cxx-3173 branch November 11, 2024 21:31
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.

2 participants