CXX-3173 Make make_unique.hpp an internal header #1265
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 understdx/
, 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 thebsoncxx::detail
namespace for consistency with other internal interfaces and avoid confusion with publicv_noabi
(it is not part of the ABI) orstdx
(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.