From Jason Turner

[stack.defn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3l8yyp0z/{from.md → to.md} +27 -26
tmp/tmp3l8yyp0z/{from.md → to.md} RENAMED
@@ -3,48 +3,49 @@
3
  ``` cpp
4
  namespace std {
5
  template<class T, class Container = deque<T>>
6
  class stack {
7
  public:
8
- using value_type = typename Container::value_type;
9
- using reference = typename Container::reference;
10
- using const_reference = typename Container::const_reference;
11
- using size_type = typename Container::size_type;
12
  using container_type = Container;
13
 
14
  protected:
15
  Container c;
16
 
17
  public:
18
- stack() : stack(Container()) {}
19
- explicit stack(const Container&);
20
- explicit stack(Container&&);
21
- template<class InputIterator> stack(InputIterator first, InputIterator last);
22
- template<container-compatible-range<T> R> stack(from_range_t, R&& rg);
23
- template<class Alloc> explicit stack(const Alloc&);
24
- template<class Alloc> stack(const Container&, const Alloc&);
25
- template<class Alloc> stack(Container&&, const Alloc&);
26
- template<class Alloc> stack(const stack&, const Alloc&);
27
- template<class Alloc> stack(stack&&, const Alloc&);
 
28
  template<class InputIterator, class Alloc>
29
- stack(InputIterator first, InputIterator last, const Alloc&);
30
  template<container-compatible-range<T> R, class Alloc>
31
- stack(from_range_t, R&& rg, const Alloc&);
32
 
33
- [[nodiscard]] bool empty() const { return c.empty(); }
34
- size_type size() const { return c.size(); }
35
- reference top() { return c.back(); }
36
- const_reference top() const { return c.back(); }
37
- void push(const value_type& x) { c.push_back(x); }
38
- void push(value_type&& x) { c.push_back(std::move(x)); }
39
  template<container-compatible-range<T> R>
40
- void push_range(R&& rg);
41
  template<class... Args>
42
- decltype(auto) emplace(Args&&... args)
43
  { return c.emplace_back(std::forward<Args>(args)...); }
44
- void pop() { c.pop_back(); }
45
- void swap(stack& s) noexcept(is_nothrow_swappable_v<Container>)
46
  { using std::swap; swap(c, s.c); }
47
  };
48
 
49
  template<class Container>
50
  stack(Container) -> stack<typename Container::value_type, Container>;
 
3
  ``` cpp
4
  namespace std {
5
  template<class T, class Container = deque<T>>
6
  class stack {
7
  public:
8
+ using value_type = Container::value_type;
9
+ using reference = Container::reference;
10
+ using const_reference = Container::const_reference;
11
+ using size_type = Container::size_type;
12
  using container_type = Container;
13
 
14
  protected:
15
  Container c;
16
 
17
  public:
18
+ constexpr stack() : stack(Container()) {}
19
+ constexpr explicit stack(const Container&);
20
+ constexpr explicit stack(Container&&);
21
+ template<class InputIterator> constexpr stack(InputIterator first, InputIterator last);
22
+ template<container-compatible-range<T> R>
23
+ constexpr stack(from_range_t, R&& rg);
24
+ template<class Alloc> constexpr explicit stack(const Alloc&);
25
+ template<class Alloc> constexpr stack(const Container&, const Alloc&);
26
+ template<class Alloc> constexpr stack(Container&&, const Alloc&);
27
+ template<class Alloc> constexpr stack(const stack&, const Alloc&);
28
+ template<class Alloc> constexpr stack(stack&&, const Alloc&);
29
  template<class InputIterator, class Alloc>
30
+ constexpr stack(InputIterator first, InputIterator last, const Alloc&);
31
  template<container-compatible-range<T> R, class Alloc>
32
+ constexpr stack(from_range_t, R&& rg, const Alloc&);
33
 
34
+ constexpr bool empty() const { return c.empty(); }
35
+ constexpr size_type size() const { return c.size(); }
36
+ constexpr reference top() { return c.back(); }
37
+ constexpr const_reference top() const { return c.back(); }
38
+ constexpr void push(const value_type& x) { c.push_back(x); }
39
+ constexpr void push(value_type&& x) { c.push_back(std::move(x)); }
40
  template<container-compatible-range<T> R>
41
+ constexpr void push_range(R&& rg);
42
  template<class... Args>
43
+ constexpr decltype(auto) emplace(Args&&... args)
44
  { return c.emplace_back(std::forward<Args>(args)...); }
45
+ constexpr void pop() { c.pop_back(); }
46
+ constexpr void swap(stack& s) noexcept(is_nothrow_swappable_v<Container>)
47
  { using std::swap; swap(c, s.c); }
48
  };
49
 
50
  template<class Container>
51
  stack(Container) -> stack<typename Container::value_type, Container>;