Skip to content

Commit 03443bd

Browse files
jensmaurertkoeppe
authored andcommitted
P1425R4 Iterators pair constructors for stack and queue
1 parent 3d42b3c commit 03443bd

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

source/containers.tex

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9852,11 +9852,14 @@
98529852
queue() : queue(Container()) {}
98539853
explicit queue(const Container&);
98549854
explicit queue(Container&&);
9855+
template<class InputIterator> queue(InputIterator first, InputIterator last);
98559856
template<class Alloc> explicit queue(const Alloc&);
98569857
template<class Alloc> queue(const Container&, const Alloc&);
98579858
template<class Alloc> queue(Container&&, const Alloc&);
98589859
template<class Alloc> queue(const queue&, const Alloc&);
98599860
template<class Alloc> queue(queue&&, const Alloc&);
9861+
template<class InputIterator, class Alloc>
9862+
queue(InputIterator first, InputIterator last, const Alloc&);
98609863

98619864
[[nodiscard]] bool empty() const { return c.empty(); }
98629865
size_type size() const { return c.size(); }
@@ -9877,9 +9880,17 @@
98779880
template<class Container>
98789881
queue(Container) -> queue<typename Container::value_type, Container>;
98799882

9883+
template<class InputIterator>
9884+
queue(InputIterator, InputIterator) -> queue<@\exposid{iter-value-type}@<InputIterator>>;
9885+
98809886
template<class Container, class Allocator>
98819887
queue(Container, Allocator) -> queue<typename Container::value_type, Container>;
98829888

9889+
template<class InputIterator, class Allocator>
9890+
queue(InputIterator, InputIterator, Allocator)
9891+
-> queue<@\exposid{iter-value-type}@<InputIterator>, deque<@\exposid{iter-value-type}@<InputIterator>,
9892+
Allocator>>;
9893+
98839894
template<class T, class Container, class Alloc>
98849895
struct uses_allocator<queue<T, Container>, Alloc>
98859896
: uses_allocator<Container, Alloc>::type { };
@@ -9908,6 +9919,18 @@
99089919
Initializes \tcode{c} with \tcode{std::move(cont)}.
99099920
\end{itemdescr}
99109921

9922+
\begin{itemdecl}
9923+
template<class InputIterator>
9924+
queue(InputIterator first, InputIterator last);
9925+
\end{itemdecl}
9926+
9927+
\begin{itemdescr}
9928+
\pnum
9929+
\effects
9930+
Initializes \tcode{c} with
9931+
\tcode{first} as the first argument and \tcode{last} as the second argument.
9932+
\end{itemdescr}
9933+
99119934
\rSec3[queue.cons.alloc]{Constructors with allocators}
99129935

99139936
\pnum
@@ -9968,6 +9991,20 @@
99689991
as the second argument.
99699992
\end{itemdescr}
99709993

9994+
\begin{itemdecl}
9995+
template<class InputIterator, class Alloc>
9996+
queue(InputIterator first, InputIterator last, const Alloc& alloc);
9997+
\end{itemdecl}
9998+
9999+
\begin{itemdescr}
10000+
\pnum
10001+
\effects
10002+
Initializes \tcode{c} with
10003+
\tcode{first} as the first argument,
10004+
\tcode{last} as the second argument, and
10005+
\tcode{alloc} as the third argument.
10006+
\end{itemdescr}
10007+
997110008
\rSec3[queue.ops]{Operators}
997210009

997310010
\indexlibrarymember{operator==}{queue}%
@@ -10535,11 +10572,14 @@
1053510572
stack() : stack(Container()) {}
1053610573
explicit stack(const Container&);
1053710574
explicit stack(Container&&);
10575+
template<class InputIterator> stack(InputIterator first, InputIterator last);
1053810576
template<class Alloc> explicit stack(const Alloc&);
1053910577
template<class Alloc> stack(const Container&, const Alloc&);
1054010578
template<class Alloc> stack(Container&&, const Alloc&);
1054110579
template<class Alloc> stack(const stack&, const Alloc&);
1054210580
template<class Alloc> stack(stack&&, const Alloc&);
10581+
template<class InputIterator, class Alloc>
10582+
stack(InputIterator first, InputIterator last, const Alloc&);
1054310583

1054410584
[[nodiscard]] bool empty() const { return c.empty(); }
1054510585
size_type size() const { return c.size(); }
@@ -10558,9 +10598,17 @@
1055810598
template<class Container>
1055910599
stack(Container) -> stack<typename Container::value_type, Container>;
1056010600

10601+
template<class InputIterator>
10602+
stack(InputIterator, InputIterator) -> stack<@\exposid{iter-value-type}@<InputIterator>>;
10603+
1056110604
template<class Container, class Allocator>
1056210605
stack(Container, Allocator) -> stack<typename Container::value_type, Container>;
1056310606

10607+
template<class InputIterator, class Allocator>
10608+
stack(InputIterator, InputIterator, Allocator)
10609+
-> stack<@\exposid{iter-value-type}@<InputIterator>, deque<@\exposid{iter-value-type}@<InputIterator>,
10610+
Allocator>>;
10611+
1056410612
template<class T, class Container, class Alloc>
1056510613
struct uses_allocator<stack<T, Container>, Alloc>
1056610614
: uses_allocator<Container, Alloc>::type { };
@@ -10591,6 +10639,19 @@
1059110639
Initializes \tcode{c} with \tcode{std::move(cont)}.
1059210640
\end{itemdescr}
1059310641

10642+
\indexlibraryctor{stack}%
10643+
\begin{itemdecl}
10644+
template<class InputIterator>
10645+
stack(InputIterator first, InputIterator last);
10646+
\end{itemdecl}
10647+
10648+
\begin{itemdescr}
10649+
\pnum
10650+
\effects
10651+
Initializes \tcode{c} with
10652+
\tcode{first} as the first argument and \tcode{last} as the second argument.
10653+
\end{itemdescr}
10654+
1059410655
\rSec3[stack.cons.alloc]{Constructors with allocators}
1059510656

1059610657
\pnum
@@ -10656,6 +10717,21 @@
1065610717
as the second argument.
1065710718
\end{itemdescr}
1065810719

10720+
\indexlibraryctor{stack}%
10721+
\begin{itemdecl}
10722+
template<class InputIterator, class Alloc>
10723+
stack(InputIterator first, InputIterator last, const Alloc& alloc);
10724+
\end{itemdecl}
10725+
10726+
\begin{itemdescr}
10727+
\pnum
10728+
\effects
10729+
Initializes \tcode{c} with
10730+
\tcode{first} as the first argument,
10731+
\tcode{last} as the second argument, and
10732+
\tcode{alloc} as the third argument.
10733+
\end{itemdescr}
10734+
1065910735
\rSec3[stack.ops]{Operators}
1066010736

1066110737
\indexlibrarymember{operator==}{stack}%

source/support.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@
556556
#define @\defnlibxname{cpp_lib_allocator_traits_is_always_equal}@ 201411L
557557
// also in \libheader{memory}, \libheader{scoped_allocator}, \libheader{string}, \libheader{deque}, \libheader{forward_list}, \libheader{list}, \libheader{vector},
558558
// \libheader{map}, \libheader{set}, \libheader{unordered_map}, \libheader{unordered_set}
559+
#define @\defnlibxname{cpp_lib_adaptor_iterator_pair_constructor}@ 202106L // also in \libheader{stack}, \libheader{queue>}
559560
#define @\defnlibxname{cpp_lib_any}@ 201606L // also in \libheader{any}
560561
#define @\defnlibxname{cpp_lib_apply}@ 201603L // also in \libheader{tuple}
561562
#define @\defnlibxname{cpp_lib_array_constexpr}@ 201811L // also in \libheader{iterator}, \libheader{array}

0 commit comments

Comments
 (0)