Skip to content

Implement P1425 iterator range constructors for stack and queue - #1994

Merged
Stephan T. Lavavej (StephanTLavavej) merged 19 commits into
microsoft:mainfrom
miscco:p1425r4-stack-queue-constructors
Aug 17, 2021
Merged

Implement P1425 iterator range constructors for stack and queue#1994
Stephan T. Lavavej (StephanTLavavej) merged 19 commits into
microsoft:mainfrom
miscco:p1425r4-stack-queue-constructors

Conversation

@miscco

@miscco Michael Schellenberger Costa (miscco) commented Jun 9, 2021

Copy link
Copy Markdown
Contributor

This implements P1425.

While we are at it it also implements LWG-3506 and LWG-3522. (There is nothing to do for LWG-3529 - it's already implemented.)

Addresses #1965
Fixes #1973

@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) added cxx23 C++23 feature LWG Library Working Group issue labels Jun 10, 2021
@StephanTLavavej

This comment has been minimized.

@frederick-vs-ja

Copy link
Copy Markdown
Contributor

Is it intended not to apply LWG-3506 to C++14/17 modes?

@miscco

Copy link
Copy Markdown
Contributor Author

That is a good point. The maintainers can give direction

Comment thread tests/std/test.lst Outdated
Comment thread stl/inc/queue Outdated
Comment thread stl/inc/queue Outdated
Comment on lines +275 to +276
template <class _InIt, class _Alloc, enable_if_t<uses_allocator_v<_Container, _Alloc>, int> = 0>
priority_queue(_InIt _First, _InIt _Last, const _Pr& _Pred, const _Container& _Cont, const _Alloc& _Al)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

According to LWG-3522, all of these priority_queue constructors taking _InIt should be additionally constrained by _Is_iterator, so I think we need to conjunction_v all 4 of them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I went with simple && as I believe we do not really need the short circuiting of conjunction and might avoid some type instantiations

Comment thread stl/inc/queue Outdated
Comment thread stl/inc/queue Outdated
Comment thread stl/inc/queue Outdated
Comment thread tests/std/tests/P1425R6_queue_stack_constructors/test.cpp Outdated
Comment thread tests/std/tests/P1425R6_queue_stack_constructors/test.cpp
Comment thread stl/inc/queue
@StephanTLavavej

This comment has been minimized.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, thanks! I'll validate and push some changes.

Comment thread stl/inc/yvals_core.h Outdated
Comment thread stl/inc/queue Outdated
Comment thread tests/std/tests/P1425R4_queue_stack_constructors/test.cpp
Comment thread tests/std/tests/P1425R4_queue_stack_constructors/test.cpp Outdated
Comment thread tests/std/tests/P1425R4_queue_stack_constructors/test.cpp Outdated
Comment thread tests/std/tests/P1425R4_queue_stack_constructors/test.cpp Outdated
Comment thread tests/std/tests/P1425R4_queue_stack_constructors/test.cpp
Comment thread tests/std/tests/P1425R4_queue_stack_constructors/test.cpp Outdated
Comment thread tests/std/tests/P1425R4_queue_stack_constructors/test.cpp
Comment thread tests/std/tests/P1425R4_queue_stack_constructors/test.cpp Outdated
@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to an MSVC-internal PR. It's totally fine to push changes for code review feedback, but please notify me in that case.

using namespace std;

constexpr int some_data[] = {0, 1, 2, 3, 4, 5};
constexpr int additional_data[] = {6, 7, 8, 9, 10, 11};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These variable names are truly inspired. (No change requested.)

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 46477a1 into microsoft:main Aug 17, 2021
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for implementing this C++23 feature and related LWG issue resolutions! 😻 ✔️ 🚀

@miscco
Michael Schellenberger Costa (miscco) deleted the p1425r4-stack-queue-constructors branch August 21, 2021 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cxx23 C++23 feature LWG Library Working Group issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P1425R4 Iterator Pair Constructors For stack And queue

4 participants