From Jason Turner

[array.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpjghd1ru5/{from.md → to.md} +28 -19
tmp/tmpjghd1ru5/{from.md → to.md} RENAMED
@@ -1,30 +1,39 @@
1
- #### Class template `array` overview <a id="array.overview">[[array.overview]]</a>
2
 
3
  The header `<array>` defines a class template for storing fixed-size
4
- sequences of objects. An `array` is a contiguous container (
5
- [[container.requirements.general]]). An instance of `array<T, N>` stores
6
  `N` elements of type `T`, so that `size() == N` is an invariant.
7
 
8
- An `array` is an aggregate ([[dcl.init.aggr]]) that can be
9
  list-initialized with up to `N` elements whose types are convertible to
10
  `T`.
11
 
12
- An `array` satisfies all of the requirements of a container and of a
13
- reversible container ([[container.requirements]]), except that a
14
- default constructed `array` object is not empty and that `swap` does not
15
- have constant complexity. An `array` satisfies some of the requirements
16
- of a sequence container ([[sequence.reqmts]]). Descriptions are
17
- provided here only for operations on `array` that are not described in
18
- one of these tables and for operations where there is additional
19
- semantic information.
 
 
 
 
 
 
 
 
 
20
 
21
  ``` cpp
22
  namespace std {
23
  template<class T, size_t N>
24
  struct array {
25
- // types:
26
  using value_type = T;
27
  using pointer = T*;
28
  using const_pointer = const T*;
29
  using reference = T&;
30
  using const_reference = const T&;
@@ -35,14 +44,14 @@ namespace std {
35
  using reverse_iterator = std::reverse_iterator<iterator>;
36
  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
37
 
38
  // no explicit construct/copy/destroy for aggregate type
39
 
40
- void fill(const T& u);
41
- void swap(array&) noexcept(is_nothrow_swappable_v<T>);
42
 
43
- // iterators:
44
  constexpr iterator begin() noexcept;
45
  constexpr const_iterator begin() const noexcept;
46
  constexpr iterator end() noexcept;
47
  constexpr const_iterator end() const noexcept;
48
 
@@ -54,16 +63,16 @@ namespace std {
54
  constexpr const_iterator cbegin() const noexcept;
55
  constexpr const_iterator cend() const noexcept;
56
  constexpr const_reverse_iterator crbegin() const noexcept;
57
  constexpr const_reverse_iterator crend() const noexcept;
58
 
59
- // capacity:
60
- constexpr bool empty() const noexcept;
61
  constexpr size_type size() const noexcept;
62
  constexpr size_type max_size() const noexcept;
63
 
64
- // element access:
65
  constexpr reference operator[](size_type n);
66
  constexpr const_reference operator[](size_type n) const;
67
  constexpr reference at(size_type n);
68
  constexpr const_reference at(size_type n) const;
69
  constexpr reference front();
 
1
+ #### Overview <a id="array.overview">[[array.overview]]</a>
2
 
3
  The header `<array>` defines a class template for storing fixed-size
4
+ sequences of objects. An `array` is a contiguous container
5
+ [[container.requirements.general]]. An instance of `array<T, N>` stores
6
  `N` elements of type `T`, so that `size() == N` is an invariant.
7
 
8
+ An `array` is an aggregate [[dcl.init.aggr]] that can be
9
  list-initialized with up to `N` elements whose types are convertible to
10
  `T`.
11
 
12
+ An `array` meets all of the requirements of a container and of a
13
+ reversible container [[container.requirements]], except that a default
14
+ constructed `array` object is not empty and that `swap` does not have
15
+ constant complexity. An `array` meets some of the requirements of a
16
+ sequence container [[sequence.reqmts]]. Descriptions are provided here
17
+ only for operations on `array` that are not described in one of these
18
+ tables and for operations where there is additional semantic
19
+ information.
20
+
21
+ `array<T, N>` is a structural type [[temp.param]] if `T` is a structural
22
+ type. Two values `a1` and `a2` of type `array<T, N>` are
23
+ template-argument-equivalent [[temp.type]] if and only if each pair of
24
+ corresponding elements in `a1` and `a2` are
25
+ template-argument-equivalent.
26
+
27
+ The types `iterator` and `const_iterator` meet the constexpr iterator
28
+ requirements [[iterator.requirements.general]].
29
 
30
  ``` cpp
31
  namespace std {
32
  template<class T, size_t N>
33
  struct array {
34
+ // types
35
  using value_type = T;
36
  using pointer = T*;
37
  using const_pointer = const T*;
38
  using reference = T&;
39
  using const_reference = const T&;
 
44
  using reverse_iterator = std::reverse_iterator<iterator>;
45
  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
46
 
47
  // no explicit construct/copy/destroy for aggregate type
48
 
49
+ constexpr void fill(const T& u);
50
+ constexpr void swap(array&) noexcept(is_nothrow_swappable_v<T>);
51
 
52
+ // iterators
53
  constexpr iterator begin() noexcept;
54
  constexpr const_iterator begin() const noexcept;
55
  constexpr iterator end() noexcept;
56
  constexpr const_iterator end() const noexcept;
57
 
 
63
  constexpr const_iterator cbegin() const noexcept;
64
  constexpr const_iterator cend() const noexcept;
65
  constexpr const_reverse_iterator crbegin() const noexcept;
66
  constexpr const_reverse_iterator crend() const noexcept;
67
 
68
+ // capacity
69
+ [[nodiscard]] constexpr bool empty() const noexcept;
70
  constexpr size_type size() const noexcept;
71
  constexpr size_type max_size() const noexcept;
72
 
73
+ // element access
74
  constexpr reference operator[](size_type n);
75
  constexpr const_reference operator[](size_type n) const;
76
  constexpr reference at(size_type n);
77
  constexpr const_reference at(size_type n) const;
78
  constexpr reference front();