This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

55
cppdraft/stack/cons.md Normal file
View File

@@ -0,0 +1,55 @@
[stack.cons]
# 23 Containers library [[containers]](./#containers)
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#stack.cons)
### 23.6.6 Class template stack [[stack]](stack#cons)
#### 23.6.6.3 Constructors [stack.cons]
[🔗](#lib:stack,constructor)
`constexpr explicit stack(const Container& cont);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16646)
*Effects*: Initializes c with cont[.](#1.sentence-1)
[🔗](#lib:stack,constructor_)
`constexpr explicit stack(Container&& cont);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16657)
*Effects*: Initializes c with std::move(cont)[.](#2.sentence-1)
[🔗](#lib:stack,constructor__)
`template<class InputIterator>
constexpr stack(InputIterator first, InputIterator last);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16669)
*Effects*: Initializes c withfirst as the first argument and last as the second argument[.](#3.sentence-1)
[🔗](#lib:stack,constructor___)
`template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R>
constexpr stack(from_range_t, R&& rg);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16682)
*Effects*: Initializes c with ranges::to<Container>(std::forward<R>(rg))[.](#4.sentence-1)

View File

@@ -0,0 +1,95 @@
[stack.cons.alloc]
# 23 Containers library [[containers]](./#containers)
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#stack.cons.alloc)
### 23.6.6 Class template stack [[stack]](stack#cons.alloc)
#### 23.6.6.4 Constructors with allocators [stack.cons.alloc]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16689)
If uses_allocator_v<container_type, Alloc> is false the constructors in this subclause shall not participate in overload resolution[.](#1.sentence-1)
[🔗](#lib:stack,constructor)
`template<class Alloc> constexpr explicit stack(const Alloc& a);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16699)
*Effects*: Initializes c with a[.](#2.sentence-1)
[🔗](#lib:stack,constructor_)
`template<class Alloc> constexpr stack(const container_type& cont, const Alloc& a);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16710)
*Effects*: Initializes c with cont as the first argument and a as the
second argument[.](#3.sentence-1)
[🔗](#lib:stack,constructor__)
`template<class Alloc> constexpr stack(container_type&& cont, const Alloc& a);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16722)
*Effects*: Initializes c with std::move(cont) as the first argument and a as the second argument[.](#4.sentence-1)
[🔗](#lib:stack,constructor___)
`template<class Alloc> constexpr stack(const stack& s, const Alloc& a);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16734)
*Effects*: Initializes c with s.c as the first argument and a as the second argument[.](#5.sentence-1)
[🔗](#lib:stack,constructor____)
`template<class Alloc> constexpr stack(stack&& s, const Alloc& a);
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16746)
*Effects*: Initializes c with std::move(s.c) as the first argument and a as the second argument[.](#6.sentence-1)
[🔗](#lib:stack,constructor_____)
`template<class InputIterator, class Alloc>
constexpr stack(InputIterator first, InputIterator last, const Alloc& alloc);
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16759)
*Effects*: Initializes c withfirst as the first argument,last as the second argument, andalloc as the third argument[.](#7.sentence-1)
[🔗](#lib:stack,constructor______)
`template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R, class Alloc>
constexpr stack(from_range_t, R&& rg, const Alloc& a);
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16774)
*Effects*: Initializesc with ranges::to<Container>(std::forward<R>(rg), a)[.](#8.sentence-1)

12
cppdraft/stack/defn.md Normal file
View File

@@ -0,0 +1,12 @@
[stack.defn]
# 23 Containers library [[containers]](./#containers)
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#stack.defn)
### 23.6.6 Class template stack [[stack]](stack#defn)
#### 23.6.6.2 Definition [stack.defn]
namespace std {template<class T, class Container = deque<T>>class stack {public:using value_type = typename Container::value_type; using reference = typename Container::reference; using const_reference = typename Container::const_reference; using size_type = typename Container::size_type; using container_type = Container; protected: Container c; public:constexpr stack() : stack(Container()) {}constexpr explicit stack(const Container&); constexpr explicit stack(Container&&); template<class InputIterator> constexpr stack(InputIterator first, InputIterator last); template<[*container-compatible-range*](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R>constexpr stack(from_range_t, R&& rg); template<class Alloc> constexpr explicit stack(const Alloc&); template<class Alloc> constexpr stack(const Container&, const Alloc&); template<class Alloc> constexpr stack(Container&&, const Alloc&); template<class Alloc> constexpr stack(const stack&, const Alloc&); template<class Alloc> constexpr stack(stack&&, const Alloc&); template<class InputIterator, class Alloc>constexpr stack(InputIterator first, InputIterator last, const Alloc&); template<[*container-compatible-range*](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R, class Alloc>constexpr stack(from_range_t, R&& rg, const Alloc&); constexpr bool empty() const { return c.empty(); }constexpr size_type size() const { return c.size(); }constexpr reference top() { return c.back(); }constexpr const_reference top() const { return c.back(); }constexpr void push(const value_type& x) { c.push_back(x); }constexpr void push(value_type&& x) { c.push_back(std::move(x)); }template<[*container-compatible-range*](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R>constexpr void push_range(R&& rg); template<class... Args>constexpr decltype(auto) emplace(Args&&... args){ return c.emplace_back(std::forward<Args>(args)...); }constexpr void pop() { c.pop_back(); }constexpr void swap(stack& s) noexcept(is_nothrow_swappable_v<Container>){ using std::swap; swap(c, s.c); }}; template<class Container> stack(Container) -> stack<typename Container::value_type, Container>; template<class InputIterator> stack(InputIterator, InputIterator) -> stack<*iter-value-type*<InputIterator>>; template<ranges::[input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]") R> stack(from_range_t, R&&) -> stack<ranges::range_value_t<R>>; template<class Container, class Allocator> stack(Container, Allocator) -> stack<typename Container::value_type, Container>; template<class InputIterator, class Allocator> stack(InputIterator, InputIterator, Allocator)-> stack<*iter-value-type*<InputIterator>, deque<*iter-value-type*<InputIterator>,
Allocator>>; template<ranges::[input_range](range.refinements#concept:input_range "25.4.6Other range refinements[range.refinements]") R, class Allocator> stack(from_range_t, R&&, Allocator)-> stack<ranges::range_value_t<R>, deque<ranges::range_value_t<R>, Allocator>>; template<class T, class Container, class Alloc>struct uses_allocator<stack<T, Container>, Alloc>: uses_allocator<Container, Alloc>::type { };}

17
cppdraft/stack/general.md Normal file
View File

@@ -0,0 +1,17 @@
[stack.general]
# 23 Containers library [[containers]](./#containers)
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#stack.general)
### 23.6.6 Class template stack [[stack]](stack#general)
#### 23.6.6.1 General [stack.general]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16546)
Any sequence container supporting operationsback(),push_back() andpop_back() can be used to instantiatestack[.](#1.sentence-1)
In particular,<vector>,<list> and<deque> can be used[.](#1.sentence-2)

22
cppdraft/stack/mod.md Normal file
View File

@@ -0,0 +1,22 @@
[stack.mod]
# 23 Containers library [[containers]](./#containers)
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#stack.mod)
### 23.6.6 Class template stack [[stack]](stack#mod)
#### 23.6.6.5 Modifiers [stack.mod]
[🔗](#lib:push_range,stack)
`template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R>
constexpr void push_range(R&& rg);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16789)
*Effects*: Equivalent to c.append_range(std::forward<R>(rg)) if that is a valid expression,
otherwise ranges::copy(rg, back_inserter(c))[.](#1.sentence-1)

94
cppdraft/stack/ops.md Normal file
View File

@@ -0,0 +1,94 @@
[stack.ops]
# 23 Containers library [[containers]](./#containers)
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#stack.ops)
### 23.6.6 Class template stack [[stack]](stack#ops)
#### 23.6.6.6 Operators [stack.ops]
[🔗](#lib:operator==,stack)
`template<class T, class Container>
constexpr bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16805)
*Returns*: x.c == y.c[.](#1.sentence-1)
[🔗](#lib:operator!=,stack)
`template<class T, class Container>
constexpr bool operator!=(const stack<T, Container>& x, const stack<T, Container>& y);
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16817)
*Returns*: x.c != y.c[.](#2.sentence-1)
[🔗](#lib:operator%3c,stack)
`template<class T, class Container>
constexpr bool operator< (const stack<T, Container>& x, const stack<T, Container>& y);
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16829)
*Returns*: x.c < y.c[.](#3.sentence-1)
[🔗](#lib:operator%3e,stack)
`template<class T, class Container>
constexpr bool operator> (const stack<T, Container>& x, const stack<T, Container>& y);
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16841)
*Returns*: x.c > y.c[.](#4.sentence-1)
[🔗](#lib:operator%3c=,stack)
`template<class T, class Container>
constexpr bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16853)
*Returns*: x.c <= y.c[.](#5.sentence-1)
[🔗](#lib:operator%3e=,stack)
`template<class T, class Container>
constexpr bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y);
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16865)
*Returns*: x.c >= y.c[.](#6.sentence-1)
[🔗](#lib:operator%3c=%3e,stack)
`template<class T, [three_way_comparable](cmp.concept#concept:three_way_comparable "17.12.4Concept three_­way_­comparable[cmp.concept]") Container>
constexpr compare_three_way_result_t<Container>
operator<=>(const stack<T, Container>& x, const stack<T, Container>& y);
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16878)
*Returns*: x.c <=> y.c[.](#7.sentence-1)

28
cppdraft/stack/special.md Normal file
View File

@@ -0,0 +1,28 @@
[stack.special]
# 23 Containers library [[containers]](./#containers)
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#stack.special)
### 23.6.6 Class template stack [[stack]](stack#special)
#### 23.6.6.7 Specialized algorithms [stack.special]
[🔗](#lib:swap,stack)
`template<class T, class Container>
constexpr void swap(stack<T, Container>& x, stack<T, Container>& y)
noexcept(noexcept(x.swap(y)));
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16893)
*Constraints*: is_swappable_v<Container> is true[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16897)
*Effects*: As if by x.swap(y)[.](#2.sentence-1)

11
cppdraft/stack/syn.md Normal file
View File

@@ -0,0 +1,11 @@
[stack.syn]
# 23 Containers library [[containers]](./#containers)
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#stack.syn)
### 23.6.5 Header <stack> synopsis [stack.syn]
[🔗](#header:%3cstack%3e)
#include <compare> // see [[compare.syn]](compare.syn "17.12.1Header <compare> synopsis")#include <initializer_list> // see [[initializer.list.syn]](initializer.list.syn "17.11.2Header <initializer_­list> synopsis")namespace std {// [[stack]](stack "23.6.6Class template stack"), class template stacktemplate<class T, class Container = deque<T>> class stack; template<class T, class Container>constexpr bool operator==(const stack<T, Container>& x, const stack<T, Container>& y); template<class T, class Container>constexpr bool operator!=(const stack<T, Container>& x, const stack<T, Container>& y); template<class T, class Container>constexpr bool operator< (const stack<T, Container>& x, const stack<T, Container>& y); template<class T, class Container>constexpr bool operator> (const stack<T, Container>& x, const stack<T, Container>& y); template<class T, class Container>constexpr bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y); template<class T, class Container>constexpr bool operator>=(const stack<T, Container>& x, const stack<T, Container>& y); template<class T, [three_way_comparable](cmp.concept#concept:three_way_comparable "17.12.4Concept three_­way_­comparable[cmp.concept]") Container>constexpr compare_three_way_result_t<Container>operator<=>(const stack<T, Container>& x, const stack<T, Container>& y); template<class T, class Container>constexpr void swap(stack<T, Container>& x, stack<T, Container>& y)noexcept(noexcept(x.swap(y))); template<class T, class Container, class Alloc>struct uses_allocator<stack<T, Container>, Alloc>; // [[container.adaptors.format]](container.adaptors.format "23.6.13Container adaptors formatting"), formatter specialization for stacktemplate<class charT, class T, [formattable](format.formattable#concept:formattable "28.5.6.3Concept formattable[format.formattable]")<charT> Container>struct formatter<stack<T, Container>, charT>;}