tmp/tmphcg2kvhj/{from.md → to.md}
RENAMED
|
@@ -6,11 +6,11 @@ elements is provided:
|
|
| 6 |
``` cpp
|
| 7 |
namespace std {
|
| 8 |
template<class Allocator>
|
| 9 |
class vector<bool, Allocator> {
|
| 10 |
public:
|
| 11 |
-
// types
|
| 12 |
using value_type = bool;
|
| 13 |
using allocator_type = Allocator;
|
| 14 |
using pointer = implementation-defined;
|
| 15 |
using const_pointer = implementation-defined;
|
| 16 |
using const_reference = bool;
|
|
@@ -19,107 +19,106 @@ namespace std {
|
|
| 19 |
using iterator = implementation-defined // type of vector<bool>::iterator; // see [container.requirements]
|
| 20 |
using const_iterator = implementation-defined // type of vector<bool>::const_iterator; // see [container.requirements]
|
| 21 |
using reverse_iterator = std::reverse_iterator<iterator>;
|
| 22 |
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
| 23 |
|
| 24 |
-
// bit reference
|
| 25 |
class reference {
|
| 26 |
friend class vector;
|
| 27 |
-
reference() noexcept;
|
| 28 |
public:
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
reference& operator=(const
|
| 33 |
-
|
|
|
|
| 34 |
};
|
| 35 |
|
| 36 |
-
// construct/copy/destroy
|
| 37 |
-
vector() : vector(Allocator()) { }
|
| 38 |
-
explicit vector(const Allocator&);
|
| 39 |
-
explicit vector(size_type n, const Allocator& = Allocator());
|
| 40 |
-
vector(size_type n, const bool& value,
|
| 41 |
-
const Allocator& = Allocator());
|
| 42 |
template<class InputIterator>
|
| 43 |
-
vector(InputIterator first, InputIterator last,
|
| 44 |
-
|
| 45 |
-
vector(
|
| 46 |
-
vector(vector
|
| 47 |
-
vector(
|
| 48 |
-
vector(
|
| 49 |
-
vector(
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
vector& operator=(initializer_list<bool>);
|
| 54 |
template<class InputIterator>
|
| 55 |
-
void assign(InputIterator first, InputIterator last);
|
| 56 |
-
void assign(size_type n, const bool& t);
|
| 57 |
-
void assign(initializer_list<bool>);
|
| 58 |
-
allocator_type get_allocator() const noexcept;
|
| 59 |
|
| 60 |
-
// iterators
|
| 61 |
-
iterator begin() noexcept;
|
| 62 |
-
const_iterator begin() const noexcept;
|
| 63 |
-
iterator end() noexcept;
|
| 64 |
-
const_iterator end() const noexcept;
|
| 65 |
-
reverse_iterator rbegin() noexcept;
|
| 66 |
-
const_reverse_iterator rbegin() const noexcept;
|
| 67 |
-
reverse_iterator rend() noexcept;
|
| 68 |
-
const_reverse_iterator rend() const noexcept;
|
| 69 |
|
| 70 |
-
const_iterator cbegin() const noexcept;
|
| 71 |
-
const_iterator cend() const noexcept;
|
| 72 |
-
const_reverse_iterator crbegin() const noexcept;
|
| 73 |
-
const_reverse_iterator crend() const noexcept;
|
| 74 |
|
| 75 |
-
// capacity
|
| 76 |
-
bool
|
| 77 |
-
size_type size() const noexcept;
|
| 78 |
-
size_type max_size() const noexcept;
|
| 79 |
-
size_type capacity() const noexcept;
|
| 80 |
-
void resize(size_type sz, bool c = false);
|
| 81 |
-
void reserve(size_type n);
|
| 82 |
-
void shrink_to_fit();
|
| 83 |
|
| 84 |
-
// element access
|
| 85 |
-
reference operator[](size_type n);
|
| 86 |
-
const_reference operator[](size_type n) const;
|
| 87 |
-
const_reference at(size_type n) const;
|
| 88 |
-
reference at(size_type n);
|
| 89 |
-
reference front();
|
| 90 |
-
const_reference front() const;
|
| 91 |
-
reference back();
|
| 92 |
-
const_reference back() const;
|
| 93 |
|
| 94 |
-
// modifiers
|
| 95 |
-
template
|
| 96 |
-
void push_back(const bool& x);
|
| 97 |
-
void pop_back();
|
| 98 |
-
template
|
| 99 |
-
iterator insert(const_iterator position, const bool& x);
|
| 100 |
-
iterator insert(const_iterator position, size_type n, const bool& x);
|
| 101 |
template<class InputIterator>
|
| 102 |
-
iterator insert(const_iterator position,
|
| 103 |
InputIterator first, InputIterator last);
|
| 104 |
-
iterator insert(const_iterator position, initializer_list<bool> il);
|
| 105 |
|
| 106 |
-
iterator erase(const_iterator position);
|
| 107 |
-
iterator erase(const_iterator first, const_iterator last);
|
| 108 |
-
void swap(vector
|
| 109 |
-
static void swap(reference x, reference y) noexcept;
|
| 110 |
-
void flip() noexcept;
|
| 111 |
-
void clear() noexcept;
|
| 112 |
};
|
| 113 |
}
|
| 114 |
```
|
| 115 |
|
| 116 |
Unless described below, all operations have the same requirements and
|
| 117 |
semantics as the primary `vector` template, except that operations
|
| 118 |
dealing with the `bool` value type map to bit values in the container
|
| 119 |
-
storage and `allocator_traits::construct`
|
| 120 |
-
|
| 121 |
|
| 122 |
There is no requirement that the data be stored as a contiguous
|
| 123 |
allocation of `bool` values. A space-optimized representation of bits is
|
| 124 |
recommended instead.
|
| 125 |
|
|
@@ -130,17 +129,17 @@ is a class that simulates the behavior of references of a single bit in
|
|
| 130 |
set, and `false` otherwise. The assignment operator sets the bit when
|
| 131 |
the argument is (convertible to) `true` and clears it otherwise. `flip`
|
| 132 |
reverses the state of the bit.
|
| 133 |
|
| 134 |
``` cpp
|
| 135 |
-
void flip() noexcept;
|
| 136 |
```
|
| 137 |
|
| 138 |
*Effects:* Replaces each element in the container with its complement.
|
| 139 |
|
| 140 |
``` cpp
|
| 141 |
-
static void swap(reference x, reference y) noexcept;
|
| 142 |
```
|
| 143 |
|
| 144 |
*Effects:* Exchanges the contents of `x` and `y` as if by:
|
| 145 |
|
| 146 |
``` cpp
|
|
@@ -151,7 +150,7 @@ y = b;
|
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
template<class Allocator> struct hash<vector<bool, Allocator>>;
|
| 154 |
```
|
| 155 |
|
| 156 |
-
The specialization is enabled
|
| 157 |
|
|
|
|
| 6 |
``` cpp
|
| 7 |
namespace std {
|
| 8 |
template<class Allocator>
|
| 9 |
class vector<bool, Allocator> {
|
| 10 |
public:
|
| 11 |
+
// types
|
| 12 |
using value_type = bool;
|
| 13 |
using allocator_type = Allocator;
|
| 14 |
using pointer = implementation-defined;
|
| 15 |
using const_pointer = implementation-defined;
|
| 16 |
using const_reference = bool;
|
|
|
|
| 19 |
using iterator = implementation-defined // type of vector<bool>::iterator; // see [container.requirements]
|
| 20 |
using const_iterator = implementation-defined // type of vector<bool>::const_iterator; // see [container.requirements]
|
| 21 |
using reverse_iterator = std::reverse_iterator<iterator>;
|
| 22 |
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
| 23 |
|
| 24 |
+
// bit reference
|
| 25 |
class reference {
|
| 26 |
friend class vector;
|
| 27 |
+
constexpr reference() noexcept;
|
| 28 |
public:
|
| 29 |
+
constexpr reference(const reference&) = default;
|
| 30 |
+
constexpr ~reference();
|
| 31 |
+
constexpr operator bool() const noexcept;
|
| 32 |
+
constexpr reference& operator=(const bool x) noexcept;
|
| 33 |
+
constexpr reference& operator=(const reference& x) noexcept;
|
| 34 |
+
constexpr void flip() noexcept; // flips the bit
|
| 35 |
};
|
| 36 |
|
| 37 |
+
// construct/copy/destroy
|
| 38 |
+
constexpr vector() : vector(Allocator()) { }
|
| 39 |
+
constexpr explicit vector(const Allocator&);
|
| 40 |
+
constexpr explicit vector(size_type n, const Allocator& = Allocator());
|
| 41 |
+
constexpr vector(size_type n, const bool& value, const Allocator& = Allocator());
|
|
|
|
| 42 |
template<class InputIterator>
|
| 43 |
+
constexpr vector(InputIterator first, InputIterator last, const Allocator& = Allocator());
|
| 44 |
+
constexpr vector(const vector& x);
|
| 45 |
+
constexpr vector(vector&& x);
|
| 46 |
+
constexpr vector(const vector&, const Allocator&);
|
| 47 |
+
constexpr vector(vector&&, const Allocator&);
|
| 48 |
+
constexpr vector(initializer_list<bool>, const Allocator& = Allocator()));
|
| 49 |
+
constexpr ~vector();
|
| 50 |
+
constexpr vector& operator=(const vector& x);
|
| 51 |
+
constexpr vector& operator=(vector&& x);
|
| 52 |
+
constexpr vector& operator=(initializer_list<bool>);
|
|
|
|
| 53 |
template<class InputIterator>
|
| 54 |
+
constexpr void assign(InputIterator first, InputIterator last);
|
| 55 |
+
constexpr void assign(size_type n, const bool& t);
|
| 56 |
+
constexpr void assign(initializer_list<bool>);
|
| 57 |
+
constexpr allocator_type get_allocator() const noexcept;
|
| 58 |
|
| 59 |
+
// iterators
|
| 60 |
+
constexpr iterator begin() noexcept;
|
| 61 |
+
constexpr const_iterator begin() const noexcept;
|
| 62 |
+
constexpr iterator end() noexcept;
|
| 63 |
+
constexpr const_iterator end() const noexcept;
|
| 64 |
+
constexpr reverse_iterator rbegin() noexcept;
|
| 65 |
+
constexpr const_reverse_iterator rbegin() const noexcept;
|
| 66 |
+
constexpr reverse_iterator rend() noexcept;
|
| 67 |
+
constexpr const_reverse_iterator rend() const noexcept;
|
| 68 |
|
| 69 |
+
constexpr const_iterator cbegin() const noexcept;
|
| 70 |
+
constexpr const_iterator cend() const noexcept;
|
| 71 |
+
constexpr const_reverse_iterator crbegin() const noexcept;
|
| 72 |
+
constexpr const_reverse_iterator crend() const noexcept;
|
| 73 |
|
| 74 |
+
// capacity
|
| 75 |
+
[[nodiscard]] constexpr bool empty() const noexcept;
|
| 76 |
+
constexpr size_type size() const noexcept;
|
| 77 |
+
constexpr size_type max_size() const noexcept;
|
| 78 |
+
constexpr size_type capacity() const noexcept;
|
| 79 |
+
constexpr void resize(size_type sz, bool c = false);
|
| 80 |
+
constexpr void reserve(size_type n);
|
| 81 |
+
constexpr void shrink_to_fit();
|
| 82 |
|
| 83 |
+
// element access
|
| 84 |
+
constexpr reference operator[](size_type n);
|
| 85 |
+
constexpr const_reference operator[](size_type n) const;
|
| 86 |
+
constexpr const_reference at(size_type n) const;
|
| 87 |
+
constexpr reference at(size_type n);
|
| 88 |
+
constexpr reference front();
|
| 89 |
+
constexpr const_reference front() const;
|
| 90 |
+
constexpr reference back();
|
| 91 |
+
constexpr const_reference back() const;
|
| 92 |
|
| 93 |
+
// modifiers
|
| 94 |
+
template<class... Args> constexpr reference emplace_back(Args&&... args);
|
| 95 |
+
constexpr void push_back(const bool& x);
|
| 96 |
+
constexpr void pop_back();
|
| 97 |
+
template<class... Args> constexpr iterator emplace(const_iterator position, Args&&... args);
|
| 98 |
+
constexpr iterator insert(const_iterator position, const bool& x);
|
| 99 |
+
constexpr iterator insert(const_iterator position, size_type n, const bool& x);
|
| 100 |
template<class InputIterator>
|
| 101 |
+
constexpr iterator insert(const_iterator position,
|
| 102 |
InputIterator first, InputIterator last);
|
| 103 |
+
constexpr iterator insert(const_iterator position, initializer_list<bool> il);
|
| 104 |
|
| 105 |
+
constexpr iterator erase(const_iterator position);
|
| 106 |
+
constexpr iterator erase(const_iterator first, const_iterator last);
|
| 107 |
+
constexpr void swap(vector&);
|
| 108 |
+
constexpr static void swap(reference x, reference y) noexcept;
|
| 109 |
+
constexpr void flip() noexcept; // flips all bits
|
| 110 |
+
constexpr void clear() noexcept;
|
| 111 |
};
|
| 112 |
}
|
| 113 |
```
|
| 114 |
|
| 115 |
Unless described below, all operations have the same requirements and
|
| 116 |
semantics as the primary `vector` template, except that operations
|
| 117 |
dealing with the `bool` value type map to bit values in the container
|
| 118 |
+
storage and `allocator_traits::construct` [[allocator.traits.members]]
|
| 119 |
+
is not used to construct these values.
|
| 120 |
|
| 121 |
There is no requirement that the data be stored as a contiguous
|
| 122 |
allocation of `bool` values. A space-optimized representation of bits is
|
| 123 |
recommended instead.
|
| 124 |
|
|
|
|
| 129 |
set, and `false` otherwise. The assignment operator sets the bit when
|
| 130 |
the argument is (convertible to) `true` and clears it otherwise. `flip`
|
| 131 |
reverses the state of the bit.
|
| 132 |
|
| 133 |
``` cpp
|
| 134 |
+
constexpr void flip() noexcept;
|
| 135 |
```
|
| 136 |
|
| 137 |
*Effects:* Replaces each element in the container with its complement.
|
| 138 |
|
| 139 |
``` cpp
|
| 140 |
+
constexpr static void swap(reference x, reference y) noexcept;
|
| 141 |
```
|
| 142 |
|
| 143 |
*Effects:* Exchanges the contents of `x` and `y` as if by:
|
| 144 |
|
| 145 |
``` cpp
|
|
|
|
| 150 |
|
| 151 |
``` cpp
|
| 152 |
template<class Allocator> struct hash<vector<bool, Allocator>>;
|
| 153 |
```
|
| 154 |
|
| 155 |
+
The specialization is enabled [[unord.hash]].
|
| 156 |
|