Skip to content

Conversation

@AdamBucior
Copy link
Contributor

Based on #421.
Resolves #19 and resolves #20.
Most of this was implemented by @ArtemSarmini, I've just made some minor fixes and written test coverage.

Co-Authored-By: ArtemSarmini <16746066+ArtemSarmini@users.noreply.github.com>
@AdamBucior AdamBucior requested a review from a team as a code owner February 20, 2021 16:50
Copy link
Contributor

@miscco miscco left a comment

Choose a reason for hiding this comment

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

I was todays years old as I learned about this feature.

It was a good time

@AdamBucior
Copy link
Contributor Author

Some libcxx tests needed to be disabled, because:

  1. they want non-const allocator ref, but uses_allocator_construction_args uses const allocator ref
  2. they expect const piecewise_construct_t&, but make_tuple copies piecewise_construct_t so it ends up being piecewise_construct_t&&

Copy link
Member

@StephanTLavavej StephanTLavavej left a comment

Choose a reason for hiding this comment

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

This looks awesome! I exhaustively reviewed every line against the current WP, verifying that both papers and the relevant LWG issues, plus any later edits, are implemented. I also verified the correctness of the "equivalent to" transformations (which are a nice throughput improvement). Finally, it's great that _Uses_allocator_construct is no longer defined in C++20 mode. I'll push changes for extremely nitpicky comment issues and test variable names, then we'll get a final review and merge this! 🚀

@StephanTLavavej

This comment has been minimized.

Copy link
Contributor

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

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

Only one comment, and it's actually a comment on the Standard and not this PR. This PR is great!


#if _HAS_CXX20
template <class _Ty, class _Alloc, class... _Types, enable_if_t<!_Is_specialization_v<_Ty, pair>, int> = 0>
_NODISCARD constexpr auto uses_allocator_construction_args(const _Alloc& _Al, _Types&&... _Args) noexcept {
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, these overloads of uses_allocator_construction_args are unimplementable since the Working Draft doesn't specify what types they return. (No change requested, just sharing my rage at the wording while I devise a curtly-worded issue report for LWG.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Clearly they can return anything :)

Copy link
Member

Choose a reason for hiding this comment

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

"Implementing the unimplementable" is a nice slogan though 😹

Copy link
Contributor

Choose a reason for hiding this comment

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

"Implementing the unimplementable" is a nice slogan though 😹

Ha! We should talk to @MahmoudGSaleh about getting some morale budget to have T-shirts made for all of our contributors.

@StephanTLavavej StephanTLavavej merged commit 66ca0f3 into microsoft:main Feb 26, 2021
@StephanTLavavej
Copy link
Member

Thanks @ArtemSarmini and @AdamBucior for implementing and testing these features! This will ship in VS 2019 16.10 Preview 2. 😻 🎉 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cxx20 C++20 feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P0591R4 Utility Functions For Uses-Allocator Construction P0475R1 Guaranteed Copy Elision For Piecewise Construction

5 participants