/Users/eugenesiegel/btc/bitcoin/src/prevector.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2015-2022 The Bitcoin Core developers |
2 | | // Distributed under the MIT software license, see the accompanying |
3 | | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | | |
5 | | #ifndef BITCOIN_PREVECTOR_H |
6 | | #define BITCOIN_PREVECTOR_H |
7 | | |
8 | | #include <algorithm> |
9 | | #include <cassert> |
10 | | #include <cstddef> |
11 | | #include <cstdint> |
12 | | #include <cstdlib> |
13 | | #include <cstring> |
14 | | #include <iterator> |
15 | | #include <type_traits> |
16 | | #include <utility> |
17 | | |
18 | | /** Implements a drop-in replacement for std::vector<T> which stores up to N |
19 | | * elements directly (without heap allocation). The types Size and Diff are |
20 | | * used to store element counts, and can be any unsigned + signed type. |
21 | | * |
22 | | * Storage layout is either: |
23 | | * - Direct allocation: |
24 | | * - Size _size: the number of used elements (between 0 and N) |
25 | | * - T direct[N]: an array of N elements of type T |
26 | | * (only the first _size are initialized). |
27 | | * - Indirect allocation: |
28 | | * - Size _size: the number of used elements plus N + 1 |
29 | | * - Size capacity: the number of allocated elements |
30 | | * - T* indirect: a pointer to an array of capacity elements of type T |
31 | | * (only the first _size are initialized). |
32 | | * |
33 | | * The data type T must be movable by memmove/realloc(). Once we switch to C++, |
34 | | * move constructors can be used instead. |
35 | | */ |
36 | | template<unsigned int N, typename T, typename Size = uint32_t, typename Diff = int32_t> |
37 | | class prevector { |
38 | | static_assert(std::is_trivially_copyable_v<T>); |
39 | | |
40 | | public: |
41 | | typedef Size size_type; |
42 | | typedef Diff difference_type; |
43 | | typedef T value_type; |
44 | | typedef value_type& reference; |
45 | | typedef const value_type& const_reference; |
46 | | typedef value_type* pointer; |
47 | | typedef const value_type* const_pointer; |
48 | | |
49 | | class iterator { |
50 | | T* ptr{}; |
51 | | public: |
52 | | typedef Diff difference_type; |
53 | | typedef T* pointer; |
54 | | typedef T& reference; |
55 | | using element_type = T; |
56 | | using iterator_category = std::contiguous_iterator_tag; |
57 | | iterator() = default; |
58 | 349M | iterator(T* ptr_) : ptr(ptr_) {} _ZN9prevectorILj16EhjiE8iteratorC2EPh Line | Count | Source | 58 | 1.17M | iterator(T* ptr_) : ptr(ptr_) {} |
_ZN9prevectorILj28EhjiE8iteratorC2EPh Line | Count | Source | 58 | 348M | iterator(T* ptr_) : ptr(ptr_) {} |
Unexecuted instantiation: _ZN9prevectorILj8EijiE8iteratorC2EPi Unexecuted instantiation: _ZN9prevectorILj33EhjiE8iteratorC2EPh _ZN9prevectorILj35EhjiE8iteratorC2EPh Line | Count | Source | 58 | 2.87k | iterator(T* ptr_) : ptr(ptr_) {} |
|
59 | 244M | T& operator*() const { return *ptr; } _ZNK9prevectorILj28EhjiE8iteratordeEv Line | Count | Source | 59 | 241M | T& operator*() const { return *ptr; } |
_ZNK9prevectorILj16EhjiE8iteratordeEv Line | Count | Source | 59 | 2.35M | T& operator*() const { return *ptr; } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE8iteratordeEv Unexecuted instantiation: _ZNK9prevectorILj33EhjiE8iteratordeEv _ZNK9prevectorILj35EhjiE8iteratordeEv Line | Count | Source | 59 | 2.87k | T& operator*() const { return *ptr; } |
|
60 | 59.9M | T* operator->() const { return ptr; } |
61 | | T& operator[](size_type pos) const { return ptr[pos]; } |
62 | 0 | iterator& operator++() { ptr++; return *this; } |
63 | | iterator& operator--() { ptr--; return *this; } |
64 | | iterator operator++(int) { iterator copy(*this); ++(*this); return copy; } |
65 | | iterator operator--(int) { iterator copy(*this); --(*this); return copy; } |
66 | 121M | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } _ZmiN9prevectorILj28EhjiE8iteratorES1_ Line | Count | Source | 66 | 120M | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
_ZmiN9prevectorILj16EhjiE8iteratorES1_ Line | Count | Source | 66 | 392k | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
Unexecuted instantiation: _ZmiN9prevectorILj8EijiE8iteratorES1_ Unexecuted instantiation: _ZmiN9prevectorILj33EhjiE8iteratorES1_ _ZmiN9prevectorILj35EhjiE8iteratorES1_ Line | Count | Source | 66 | 1.43k | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
|
67 | 0 | iterator operator+(size_type n) const { return iterator(ptr + n); } Unexecuted instantiation: _ZNK9prevectorILj28EhjiE8iteratorplEj Unexecuted instantiation: _ZNK9prevectorILj8EijiE8iteratorplEj Unexecuted instantiation: _ZNK9prevectorILj33EhjiE8iteratorplEj |
68 | | iterator friend operator+(size_type n, iterator x) { return x + n; } |
69 | | iterator& operator+=(size_type n) { ptr += n; return *this; } |
70 | 0 | iterator operator-(size_type n) const { return iterator(ptr - n); } |
71 | | iterator& operator-=(size_type n) { ptr -= n; return *this; } |
72 | | bool operator==(iterator x) const { return ptr == x.ptr; } |
73 | 0 | bool operator!=(iterator x) const { return ptr != x.ptr; } |
74 | | bool operator>=(iterator x) const { return ptr >= x.ptr; } |
75 | | bool operator<=(iterator x) const { return ptr <= x.ptr; } |
76 | | bool operator>(iterator x) const { return ptr > x.ptr; } |
77 | | bool operator<(iterator x) const { return ptr < x.ptr; } |
78 | | }; |
79 | | |
80 | | class reverse_iterator { |
81 | | T* ptr{}; |
82 | | public: |
83 | | typedef Diff difference_type; |
84 | | typedef T value_type; |
85 | | typedef T* pointer; |
86 | | typedef T& reference; |
87 | | typedef std::bidirectional_iterator_tag iterator_category; |
88 | | reverse_iterator() = default; |
89 | | reverse_iterator(T* ptr_) : ptr(ptr_) {} |
90 | | T& operator*() const { return *ptr; } |
91 | | T* operator->() const { return ptr; } |
92 | | reverse_iterator& operator--() { ptr++; return *this; } |
93 | | reverse_iterator& operator++() { ptr--; return *this; } |
94 | | reverse_iterator operator++(int) { reverse_iterator copy(*this); ++(*this); return copy; } |
95 | | reverse_iterator operator--(int) { reverse_iterator copy(*this); --(*this); return copy; } |
96 | | bool operator==(reverse_iterator x) const { return ptr == x.ptr; } |
97 | | bool operator!=(reverse_iterator x) const { return ptr != x.ptr; } |
98 | | }; |
99 | | |
100 | | class const_iterator { |
101 | | const T* ptr{}; |
102 | | public: |
103 | | typedef Diff difference_type; |
104 | | typedef const T* pointer; |
105 | | typedef const T& reference; |
106 | | using element_type = const T; |
107 | | using iterator_category = std::contiguous_iterator_tag; |
108 | | const_iterator() = default; |
109 | 1.20G | const_iterator(const T* ptr_) : ptr(ptr_) {} _ZN9prevectorILj16EhjiE14const_iteratorC2EPKh Line | Count | Source | 109 | 5.77M | const_iterator(const T* ptr_) : ptr(ptr_) {} |
_ZN9prevectorILj28EhjiE14const_iteratorC2EPKh Line | Count | Source | 109 | 1.19G | const_iterator(const T* ptr_) : ptr(ptr_) {} |
Unexecuted instantiation: _ZN9prevectorILj8EijiE14const_iteratorC2EPKi |
110 | 0 | const_iterator(iterator x) : ptr(&(*x)) {} |
111 | 4.27G | const T& operator*() const { return *ptr; } _ZNK9prevectorILj28EhjiE14const_iteratordeEv Line | Count | Source | 111 | 4.24G | const T& operator*() const { return *ptr; } |
_ZNK9prevectorILj16EhjiE14const_iteratordeEv Line | Count | Source | 111 | 31.3M | const T& operator*() const { return *ptr; } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratordeEv |
112 | 21.0M | const T* operator->() const { return ptr; } _ZNK9prevectorILj16EhjiE14const_iteratorptEv Line | Count | Source | 112 | 1.02M | const T* operator->() const { return ptr; } |
_ZNK9prevectorILj28EhjiE14const_iteratorptEv Line | Count | Source | 112 | 19.9M | const T* operator->() const { return ptr; } |
|
113 | 0 | const T& operator[](size_type pos) const { return ptr[pos]; } Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratorixEj Unexecuted instantiation: _ZNK9prevectorILj28EhjiE14const_iteratorixEj |
114 | 3.10G | const_iterator& operator++() { ptr++; return *this; } _ZN9prevectorILj28EhjiE14const_iteratorppEv Line | Count | Source | 114 | 3.07G | const_iterator& operator++() { ptr++; return *this; } |
_ZN9prevectorILj16EhjiE14const_iteratorppEv Line | Count | Source | 114 | 30.8M | const_iterator& operator++() { ptr++; return *this; } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE14const_iteratorppEv |
115 | 0 | const_iterator& operator--() { ptr--; return *this; } |
116 | 250M | const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; } |
117 | | const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; } |
118 | 564M | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } _ZmiN9prevectorILj16EhjiE14const_iteratorES1_ Line | Count | Source | 118 | 101k | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } |
_ZmiN9prevectorILj28EhjiE14const_iteratorES1_ Line | Count | Source | 118 | 564M | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } |
Unexecuted instantiation: _ZmiN9prevectorILj8EijiE14const_iteratorES1_ |
119 | 0 | const_iterator operator+(size_type n) const { return const_iterator(ptr + n); } Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratorplEj Unexecuted instantiation: _ZNK9prevectorILj28EhjiE14const_iteratorplEj |
120 | | const_iterator friend operator+(size_type n, const_iterator x) { return x + n; } |
121 | 146M | const_iterator& operator+=(size_type n) { ptr += n; return *this; } |
122 | 0 | const_iterator operator-(size_type n) const { return const_iterator(ptr - n); } Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratormiEj Unexecuted instantiation: _ZNK9prevectorILj28EhjiE14const_iteratormiEj |
123 | | const_iterator& operator-=(size_type n) { ptr -= n; return *this; } |
124 | 0 | bool operator==(const_iterator x) const { return ptr == x.ptr; } |
125 | 3.02G | bool operator!=(const_iterator x) const { return ptr != x.ptr; } _ZNK9prevectorILj28EhjiE14const_iteratorneES1_ Line | Count | Source | 125 | 2.99G | bool operator!=(const_iterator x) const { return ptr != x.ptr; } |
_ZNK9prevectorILj16EhjiE14const_iteratorneES1_ Line | Count | Source | 125 | 32.9M | bool operator!=(const_iterator x) const { return ptr != x.ptr; } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratorneES1_ |
126 | 250M | bool operator>=(const_iterator x) const { return ptr >= x.ptr; } |
127 | | bool operator<=(const_iterator x) const { return ptr <= x.ptr; } |
128 | | bool operator>(const_iterator x) const { return ptr > x.ptr; } |
129 | 400M | bool operator<(const_iterator x) const { return ptr < x.ptr; } |
130 | | }; |
131 | | |
132 | | class const_reverse_iterator { |
133 | | const T* ptr{}; |
134 | | public: |
135 | | typedef Diff difference_type; |
136 | | typedef const T value_type; |
137 | | typedef const T* pointer; |
138 | | typedef const T& reference; |
139 | | typedef std::bidirectional_iterator_tag iterator_category; |
140 | | const_reverse_iterator() = default; |
141 | | const_reverse_iterator(const T* ptr_) : ptr(ptr_) {} |
142 | | const_reverse_iterator(reverse_iterator x) : ptr(&(*x)) {} |
143 | | const T& operator*() const { return *ptr; } |
144 | | const T* operator->() const { return ptr; } |
145 | | const_reverse_iterator& operator--() { ptr++; return *this; } |
146 | | const_reverse_iterator& operator++() { ptr--; return *this; } |
147 | | const_reverse_iterator operator++(int) { const_reverse_iterator copy(*this); ++(*this); return copy; } |
148 | | const_reverse_iterator operator--(int) { const_reverse_iterator copy(*this); --(*this); return copy; } |
149 | | bool operator==(const_reverse_iterator x) const { return ptr == x.ptr; } |
150 | | bool operator!=(const_reverse_iterator x) const { return ptr != x.ptr; } |
151 | | }; |
152 | | |
153 | | private: |
154 | | #pragma pack(push, 1) |
155 | | union direct_or_indirect { |
156 | | char direct[sizeof(T) * N]; |
157 | | struct { |
158 | | char* indirect; |
159 | | size_type capacity; |
160 | | } indirect_contents; |
161 | | }; |
162 | | #pragma pack(pop) |
163 | | alignas(char*) direct_or_indirect _union = {}; |
164 | | size_type _size = 0; |
165 | | |
166 | | static_assert(alignof(char*) % alignof(size_type) == 0 && sizeof(char*) % alignof(size_type) == 0, "size_type cannot have more restrictive alignment requirement than pointer"); |
167 | | static_assert(alignof(char*) % alignof(T) == 0, "value_type T cannot have more restrictive alignment requirement than pointer"); |
168 | | |
169 | 462M | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } _ZN9prevectorILj28EhjiE10direct_ptrEi Line | Count | Source | 169 | 457M | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
Unexecuted instantiation: _ZN9prevectorILj33EhjiE10direct_ptrEi _ZN9prevectorILj16EhjiE10direct_ptrEi Line | Count | Source | 169 | 4.87M | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE10direct_ptrEi _ZN9prevectorILj35EhjiE10direct_ptrEi Line | Count | Source | 169 | 5.74k | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
|
170 | 1.15G | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } _ZNK9prevectorILj28EhjiE10direct_ptrEi Line | Count | Source | 170 | 1.14G | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
_ZNK9prevectorILj16EhjiE10direct_ptrEi Line | Count | Source | 170 | 7.61M | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE10direct_ptrEi Unexecuted instantiation: _ZNK9prevectorILj33EhjiE10direct_ptrEi |
171 | 244M | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } _ZN9prevectorILj28EhjiE12indirect_ptrEi Line | Count | Source | 171 | 244M | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } |
Unexecuted instantiation: _ZN9prevectorILj33EhjiE12indirect_ptrEi _ZN9prevectorILj16EhjiE12indirect_ptrEi Line | Count | Source | 171 | 309k | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE12indirect_ptrEi Unexecuted instantiation: _ZN9prevectorILj35EhjiE12indirect_ptrEi |
172 | 714M | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } _ZNK9prevectorILj28EhjiE12indirect_ptrEi Line | Count | Source | 172 | 714M | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } |
_ZNK9prevectorILj16EhjiE12indirect_ptrEi Line | Count | Source | 172 | 440k | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE12indirect_ptrEi Unexecuted instantiation: _ZNK9prevectorILj33EhjiE12indirect_ptrEi |
173 | 7.18G | bool is_direct() const { return _size <= N; } _ZNK9prevectorILj28EhjiE9is_directEv Line | Count | Source | 173 | 7.15G | bool is_direct() const { return _size <= N; } |
_ZNK9prevectorILj33EhjiE9is_directEv Line | Count | Source | 173 | 103k | bool is_direct() const { return _size <= N; } |
_ZNK9prevectorILj16EhjiE9is_directEv Line | Count | Source | 173 | 28.6M | bool is_direct() const { return _size <= N; } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE9is_directEv _ZNK9prevectorILj35EhjiE9is_directEv Line | Count | Source | 173 | 13.6k | bool is_direct() const { return _size <= N; } |
|
174 | | |
175 | 362M | void change_capacity(size_type new_capacity) { |
176 | 362M | if (new_capacity <= N) { |
177 | 306M | if (!is_direct()) { |
178 | 13.7k | T* indirect = indirect_ptr(0); |
179 | 13.7k | T* src = indirect; |
180 | 13.7k | T* dst = direct_ptr(0); |
181 | 13.7k | memcpy(dst, src, size() * sizeof(T)); |
182 | 13.7k | free(indirect); |
183 | 13.7k | _size -= N + 1; |
184 | 13.7k | } |
185 | 306M | } else { |
186 | 56.3M | if (!is_direct()) { |
187 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert |
188 | | success. These should instead use an allocator or new/delete so that handlers |
189 | | are called as necessary, but performance would be slightly degraded by doing so. */ |
190 | 355k | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); |
191 | 355k | assert(_union.indirect_contents.indirect); |
192 | 355k | _union.indirect_contents.capacity = new_capacity; |
193 | 56.0M | } else { |
194 | 56.0M | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); |
195 | 56.0M | assert(new_indirect); |
196 | 56.0M | T* src = direct_ptr(0); |
197 | 56.0M | T* dst = reinterpret_cast<T*>(new_indirect); |
198 | 56.0M | memcpy(dst, src, size() * sizeof(T)); |
199 | 56.0M | _union.indirect_contents.indirect = new_indirect; |
200 | 56.0M | _union.indirect_contents.capacity = new_capacity; |
201 | 56.0M | _size += N + 1; |
202 | 56.0M | } |
203 | 56.3M | } |
204 | 362M | } _ZN9prevectorILj28EhjiE15change_capacityEj Line | Count | Source | 175 | 359M | void change_capacity(size_type new_capacity) { | 176 | 359M | if (new_capacity <= N) { | 177 | 303M | if (!is_direct()) { | 178 | 13.7k | T* indirect = indirect_ptr(0); | 179 | 13.7k | T* src = indirect; | 180 | 13.7k | T* dst = direct_ptr(0); | 181 | 13.7k | memcpy(dst, src, size() * sizeof(T)); | 182 | 13.7k | free(indirect); | 183 | 13.7k | _size -= N + 1; | 184 | 13.7k | } | 185 | 303M | } else { | 186 | 56.1M | if (!is_direct()) { | 187 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 188 | | success. These should instead use an allocator or new/delete so that handlers | 189 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 190 | 355k | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 191 | 355k | assert(_union.indirect_contents.indirect); | 192 | 355k | _union.indirect_contents.capacity = new_capacity; | 193 | 55.7M | } else { | 194 | 55.7M | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 195 | 55.7M | assert(new_indirect); | 196 | 55.7M | T* src = direct_ptr(0); | 197 | 55.7M | T* dst = reinterpret_cast<T*>(new_indirect); | 198 | 55.7M | memcpy(dst, src, size() * sizeof(T)); | 199 | 55.7M | _union.indirect_contents.indirect = new_indirect; | 200 | 55.7M | _union.indirect_contents.capacity = new_capacity; | 201 | 55.7M | _size += N + 1; | 202 | 55.7M | } | 203 | 56.1M | } | 204 | 359M | } |
_ZN9prevectorILj16EhjiE15change_capacityEj Line | Count | Source | 175 | 3.20M | void change_capacity(size_type new_capacity) { | 176 | 3.20M | if (new_capacity <= N) { | 177 | 2.95M | if (!is_direct()) { | 178 | 0 | T* indirect = indirect_ptr(0); | 179 | 0 | T* src = indirect; | 180 | 0 | T* dst = direct_ptr(0); | 181 | 0 | memcpy(dst, src, size() * sizeof(T)); | 182 | 0 | free(indirect); | 183 | 0 | _size -= N + 1; | 184 | 0 | } | 185 | 2.95M | } else { | 186 | 254k | if (!is_direct()) { | 187 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 188 | | success. These should instead use an allocator or new/delete so that handlers | 189 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 190 | 0 | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 191 | 0 | assert(_union.indirect_contents.indirect); | 192 | 0 | _union.indirect_contents.capacity = new_capacity; | 193 | 254k | } else { | 194 | 254k | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 195 | 254k | assert(new_indirect); | 196 | 254k | T* src = direct_ptr(0); | 197 | 254k | T* dst = reinterpret_cast<T*>(new_indirect); | 198 | 254k | memcpy(dst, src, size() * sizeof(T)); | 199 | 254k | _union.indirect_contents.indirect = new_indirect; | 200 | 254k | _union.indirect_contents.capacity = new_capacity; | 201 | 254k | _size += N + 1; | 202 | 254k | } | 203 | 254k | } | 204 | 3.20M | } |
Unexecuted instantiation: _ZN9prevectorILj33EhjiE15change_capacityEj Unexecuted instantiation: _ZN9prevectorILj8EijiE15change_capacityEj _ZN9prevectorILj35EhjiE15change_capacityEj Line | Count | Source | 175 | 718 | void change_capacity(size_type new_capacity) { | 176 | 718 | if (new_capacity <= N) { | 177 | 718 | if (!is_direct()) { | 178 | 0 | T* indirect = indirect_ptr(0); | 179 | 0 | T* src = indirect; | 180 | 0 | T* dst = direct_ptr(0); | 181 | 0 | memcpy(dst, src, size() * sizeof(T)); | 182 | 0 | free(indirect); | 183 | 0 | _size -= N + 1; | 184 | 0 | } | 185 | 718 | } else { | 186 | 0 | if (!is_direct()) { | 187 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 188 | | success. These should instead use an allocator or new/delete so that handlers | 189 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 190 | 0 | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 191 | 0 | assert(_union.indirect_contents.indirect); | 192 | 0 | _union.indirect_contents.capacity = new_capacity; | 193 | 0 | } else { | 194 | 0 | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 195 | 0 | assert(new_indirect); | 196 | 0 | T* src = direct_ptr(0); | 197 | 0 | T* dst = reinterpret_cast<T*>(new_indirect); | 198 | 0 | memcpy(dst, src, size() * sizeof(T)); | 199 | 0 | _union.indirect_contents.indirect = new_indirect; | 200 | 0 | _union.indirect_contents.capacity = new_capacity; | 201 | 0 | _size += N + 1; | 202 | 0 | } | 203 | 0 | } | 204 | 718 | } |
|
205 | | |
206 | 650M | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos)406M : indirect_ptr(pos)244M ; } _ZN9prevectorILj28EhjiE8item_ptrEi Line | Count | Source | 206 | 645M | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos)401M : indirect_ptr(pos)244M ; } |
Unexecuted instantiation: _ZN9prevectorILj33EhjiE8item_ptrEi _ZN9prevectorILj16EhjiE8item_ptrEi Line | Count | Source | 206 | 4.92M | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos)4.61M : indirect_ptr(pos)309k ; } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE8item_ptrEi _ZN9prevectorILj35EhjiE8item_ptrEi Line | Count | Source | 206 | 5.74k | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos)0 ; } |
|
207 | 1.86G | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos)1.15G : indirect_ptr(pos)714M ; } _ZNK9prevectorILj28EhjiE8item_ptrEi Line | Count | Source | 207 | 1.86G | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos)1.14G : indirect_ptr(pos)714M ; } |
_ZNK9prevectorILj16EhjiE8item_ptrEi Line | Count | Source | 207 | 8.05M | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos)7.61M : indirect_ptr(pos)440k ; } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE8item_ptrEi Unexecuted instantiation: _ZNK9prevectorILj33EhjiE8item_ptrEi |
208 | | |
209 | 11.1M | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { |
210 | 11.1M | std::fill_n(dst, count, value); |
211 | 11.1M | } _ZN9prevectorILj28EhjiE4fillEPhlRKh Line | Count | Source | 209 | 9.99M | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 210 | 9.99M | std::fill_n(dst, count, value); | 211 | 9.99M | } |
_ZN9prevectorILj16EhjiE4fillEPhlRKh Line | Count | Source | 209 | 1.20M | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 210 | 1.20M | std::fill_n(dst, count, value); | 211 | 1.20M | } |
Unexecuted instantiation: _ZN9prevectorILj33EhjiE4fillEPhlRKh Unexecuted instantiation: _ZN9prevectorILj8EijiE4fillEPilRKi |
212 | | |
213 | | template <std::input_iterator InputIterator> |
214 | 213M | void fill(T* dst, InputIterator first, InputIterator last) { |
215 | 3.51G | while (first != last) { |
216 | 3.30G | new(static_cast<void*>(dst)) T(*first); |
217 | 3.30G | ++dst; |
218 | 3.30G | ++first; |
219 | 3.30G | } |
220 | 213M | } Unexecuted instantiation: _ZN9prevectorILj28EhjiE4fillITkNSt3__114input_iteratorEPKhEEvPhT_S6_ _ZN9prevectorILj28EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvPhT_S8_ Line | Count | Source | 214 | 43.2M | void fill(T* dst, InputIterator first, InputIterator last) { | 215 | 441M | while (first != last) { | 216 | 398M | new(static_cast<void*>(dst)) T(*first); | 217 | 398M | ++dst; | 218 | 398M | ++first; | 219 | 398M | } | 220 | 43.2M | } |
_ZN9prevectorILj28EhjiE4fillITkNSt3__114input_iteratorENS0_14const_iteratorEEEvPhT_S5_ Line | Count | Source | 214 | 167M | void fill(T* dst, InputIterator first, InputIterator last) { | 215 | 2.99G | while (first != last) { | 216 | 2.82G | new(static_cast<void*>(dst)) T(*first); | 217 | 2.82G | ++dst; | 218 | 2.82G | ++first; | 219 | 2.82G | } | 220 | 167M | } |
_ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorENS0_14const_iteratorEEEvPhT_S5_ Line | Count | Source | 214 | 2.09M | void fill(T* dst, InputIterator first, InputIterator last) { | 215 | 32.6M | while (first != last) { | 216 | 30.5M | new(static_cast<void*>(dst)) T(*first); | 217 | 30.5M | ++dst; | 218 | 30.5M | ++first; | 219 | 30.5M | } | 220 | 2.09M | } |
Unexecuted instantiation: _ZN9prevectorILj28EhjiE4fillITkNSt3__114input_iteratorENS0_8iteratorEEEvPhT_S5_ Unexecuted instantiation: _ZN9prevectorILj8EijiE4fillITkNSt3__114input_iteratorEPiEEvS3_T_S4_ Unexecuted instantiation: _ZN9prevectorILj8EijiE4fillITkNSt3__114input_iteratorENS0_14const_iteratorEEEvPiT_S5_ Unexecuted instantiation: _ZN9prevectorILj8EijiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKiEEEEvPiT_S8_ Unexecuted instantiation: _ZN9prevectorILj33EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvPhT_S8_ _ZN9prevectorILj28EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEEvS4_T_S6_ Line | Count | Source | 214 | 1.28M | void fill(T* dst, InputIterator first, InputIterator last) { | 215 | 45.2M | while (first != last) { | 216 | 43.9M | new(static_cast<void*>(dst)) T(*first); | 217 | 43.9M | ++dst; | 218 | 43.9M | ++first; | 219 | 43.9M | } | 220 | 1.28M | } |
_ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvPhT_S8_ Line | Count | Source | 214 | 141k | void fill(T* dst, InputIterator first, InputIterator last) { | 215 | 2.41M | while (first != last) { | 216 | 2.26M | new(static_cast<void*>(dst)) T(*first); | 217 | 2.26M | ++dst; | 218 | 2.26M | ++first; | 219 | 2.26M | } | 220 | 141k | } |
_ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorEPhEEvS3_T_S4_ Line | Count | Source | 214 | 30.0k | void fill(T* dst, InputIterator first, InputIterator last) { | 215 | 330k | while (first != last) { | 216 | 300k | new(static_cast<void*>(dst)) T(*first); | 217 | 300k | ++dst; | 218 | 300k | ++first; | 219 | 300k | } | 220 | 30.0k | } |
Unexecuted instantiation: _ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEEvS4_T_S6_ Unexecuted instantiation: _ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorEPKhEEvPhT_S6_ _ZN9prevectorILj35EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvPhT_S8_ Line | Count | Source | 214 | 718 | void fill(T* dst, InputIterator first, InputIterator last) { | 215 | 23.6k | while (first != last) { | 216 | 22.9k | new(static_cast<void*>(dst)) T(*first); | 217 | 22.9k | ++dst; | 218 | 22.9k | ++first; | 219 | 22.9k | } | 220 | 718 | } |
_ZN9prevectorILj35EhjiE4fillITkNSt3__114input_iteratorEPhEEvS3_T_S4_ Line | Count | Source | 214 | 718 | void fill(T* dst, InputIterator first, InputIterator last) { | 215 | 2.15k | while (first != last) { | 216 | 1.43k | new(static_cast<void*>(dst)) T(*first); | 217 | 1.43k | ++dst; | 218 | 1.43k | ++first; | 219 | 1.43k | } | 220 | 718 | } |
_ZN9prevectorILj35EhjiE4fillITkNSt3__114input_iteratorEPKhEEvPhT_S6_ Line | Count | Source | 214 | 718 | void fill(T* dst, InputIterator first, InputIterator last) { | 215 | 1.43k | while (first != last) { | 216 | 718 | new(static_cast<void*>(dst)) T(*first); | 217 | 718 | ++dst; | 218 | 718 | ++first; | 219 | 718 | } | 220 | 718 | } |
|
221 | | |
222 | | public: |
223 | 684 | void assign(size_type n, const T& val) { |
224 | 684 | clear(); |
225 | 684 | if (capacity() < n) { |
226 | 0 | change_capacity(n); |
227 | 0 | } |
228 | 684 | _size += n; |
229 | 684 | fill(item_ptr(0), n, val); |
230 | 684 | } _ZN9prevectorILj16EhjiE6assignEjRKh Line | Count | Source | 223 | 684 | void assign(size_type n, const T& val) { | 224 | 684 | clear(); | 225 | 684 | if (capacity() < n) { | 226 | 0 | change_capacity(n); | 227 | 0 | } | 228 | 684 | _size += n; | 229 | 684 | fill(item_ptr(0), n, val); | 230 | 684 | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE6assignEjRKi |
231 | | |
232 | | template <std::input_iterator InputIterator> |
233 | 22.8M | void assign(InputIterator first, InputIterator last) { |
234 | 22.8M | size_type n = last - first; |
235 | 22.8M | clear(); |
236 | 22.8M | if (capacity() < n) { |
237 | 1.40M | change_capacity(n); |
238 | 1.40M | } |
239 | 22.8M | _size += n; |
240 | 22.8M | fill(item_ptr(0), first, last); |
241 | 22.8M | } _ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorENS0_14const_iteratorEEEvT_S4_ Line | Count | Source | 233 | 99.7k | void assign(InputIterator first, InputIterator last) { | 234 | 99.7k | size_type n = last - first; | 235 | 99.7k | clear(); | 236 | 99.7k | if (capacity() < n) { | 237 | 1.21k | change_capacity(n); | 238 | 1.21k | } | 239 | 99.7k | _size += n; | 240 | 99.7k | fill(item_ptr(0), first, last); | 241 | 99.7k | } |
_ZN9prevectorILj28EhjiE6assignITkNSt3__114input_iteratorENS0_14const_iteratorEEEvT_S4_ Line | Count | Source | 233 | 22.5M | void assign(InputIterator first, InputIterator last) { | 234 | 22.5M | size_type n = last - first; | 235 | 22.5M | clear(); | 236 | 22.5M | if (capacity() < n) { | 237 | 1.40M | change_capacity(n); | 238 | 1.40M | } | 239 | 22.5M | _size += n; | 240 | 22.5M | fill(item_ptr(0), first, last); | 241 | 22.5M | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE6assignITkNSt3__114input_iteratorENS0_14const_iteratorEEEvT_S4_ Unexecuted instantiation: _ZN9prevectorILj33EhjiE6assignITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvT_S7_ _ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvT_S7_ Line | Count | Source | 233 | 141k | void assign(InputIterator first, InputIterator last) { | 234 | 141k | size_type n = last - first; | 235 | 141k | clear(); | 236 | 141k | if (capacity() < n) { | 237 | 0 | change_capacity(n); | 238 | 0 | } | 239 | 141k | _size += n; | 240 | 141k | fill(item_ptr(0), first, last); | 241 | 141k | } |
_ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorEPhEEvT_S4_ Line | Count | Source | 233 | 30.0k | void assign(InputIterator first, InputIterator last) { | 234 | 30.0k | size_type n = last - first; | 235 | 30.0k | clear(); | 236 | 30.0k | if (capacity() < n) { | 237 | 0 | change_capacity(n); | 238 | 0 | } | 239 | 30.0k | _size += n; | 240 | 30.0k | fill(item_ptr(0), first, last); | 241 | 30.0k | } |
Unexecuted instantiation: _ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEEvT_S6_ Unexecuted instantiation: _ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorEPKhEEvT_S5_ |
242 | | |
243 | 256M | prevector() = default; _ZN9prevectorILj28EhjiEC2Ev Line | Count | Source | 243 | 256M | prevector() = default; |
_ZN9prevectorILj33EhjiEC2Ev Line | Count | Source | 243 | 103k | prevector() = default; |
Unexecuted instantiation: _ZN9prevectorILj8EijiEC2Ev |
244 | | |
245 | | explicit prevector(size_type n) { |
246 | | resize(n); |
247 | | } |
248 | | |
249 | 1.15M | explicit prevector(size_type n, const T& val) { |
250 | 1.15M | change_capacity(n); |
251 | 1.15M | _size += n; |
252 | 1.15M | fill(item_ptr(0), n, val); |
253 | 1.15M | } Unexecuted instantiation: _ZN9prevectorILj33EhjiEC2EjRKh _ZN9prevectorILj16EhjiEC2EjRKh Line | Count | Source | 249 | 1.15M | explicit prevector(size_type n, const T& val) { | 250 | 1.15M | change_capacity(n); | 251 | 1.15M | _size += n; | 252 | 1.15M | fill(item_ptr(0), n, val); | 253 | 1.15M | } |
|
254 | | |
255 | | template <std::input_iterator InputIterator> |
256 | 718 | prevector(InputIterator first, InputIterator last) { |
257 | 718 | size_type n = last - first; |
258 | 718 | change_capacity(n); |
259 | 718 | _size += n; |
260 | 718 | fill(item_ptr(0), first, last); |
261 | 718 | } Unexecuted instantiation: _ZN9prevectorILj28EhjiEC2ITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEET_S7_ Unexecuted instantiation: _ZN9prevectorILj8EijiEC2ITkNSt3__114input_iteratorENS2_11__wrap_iterIPKiEEEET_S7_ Unexecuted instantiation: _ZN9prevectorILj8EijiEC2ITkNSt3__114input_iteratorENS0_14const_iteratorEEET_S4_ Unexecuted instantiation: _ZN9prevectorILj28EhjiEC2ITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEET_S6_ _ZN9prevectorILj35EhjiEC2ITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEET_S7_ Line | Count | Source | 256 | 718 | prevector(InputIterator first, InputIterator last) { | 257 | 718 | size_type n = last - first; | 258 | 718 | change_capacity(n); | 259 | 718 | _size += n; | 260 | 718 | fill(item_ptr(0), first, last); | 261 | 718 | } |
Unexecuted instantiation: _ZN9prevectorILj28EhjiEC2ITkNSt3__114input_iteratorENS0_14const_iteratorEEET_S4_ |
262 | | |
263 | 146M | prevector(const prevector<N, T, Size, Diff>& other) { |
264 | 146M | size_type n = other.size(); |
265 | 146M | change_capacity(n); |
266 | 146M | _size += n; |
267 | 146M | fill(item_ptr(0), other.begin(), other.end()); |
268 | 146M | } _ZN9prevectorILj16EhjiEC2ERKS0_ Line | Count | Source | 263 | 1.99M | prevector(const prevector<N, T, Size, Diff>& other) { | 264 | 1.99M | size_type n = other.size(); | 265 | 1.99M | change_capacity(n); | 266 | 1.99M | _size += n; | 267 | 1.99M | fill(item_ptr(0), other.begin(), other.end()); | 268 | 1.99M | } |
_ZN9prevectorILj28EhjiEC2ERKS0_ Line | Count | Source | 263 | 144M | prevector(const prevector<N, T, Size, Diff>& other) { | 264 | 144M | size_type n = other.size(); | 265 | 144M | change_capacity(n); | 266 | 144M | _size += n; | 267 | 144M | fill(item_ptr(0), other.begin(), other.end()); | 268 | 144M | } |
|
269 | | |
270 | | prevector(prevector<N, T, Size, Diff>&& other) noexcept |
271 | 21.9M | : _union(std::move(other._union)), _size(other._size) |
272 | 21.9M | { |
273 | 21.9M | other._size = 0; |
274 | 21.9M | } _ZN9prevectorILj16EhjiEC2EOS0_ Line | Count | Source | 271 | 3.69k | : _union(std::move(other._union)), _size(other._size) | 272 | 3.69k | { | 273 | 3.69k | other._size = 0; | 274 | 3.69k | } |
_ZN9prevectorILj28EhjiEC2EOS0_ Line | Count | Source | 271 | 21.9M | : _union(std::move(other._union)), _size(other._size) | 272 | 21.9M | { | 273 | 21.9M | other._size = 0; | 274 | 21.9M | } |
|
275 | | |
276 | 22.6M | prevector& operator=(const prevector<N, T, Size, Diff>& other) { |
277 | 22.6M | if (&other == this) { |
278 | 0 | return *this; |
279 | 0 | } |
280 | 22.6M | assign(other.begin(), other.end()); |
281 | 22.6M | return *this; |
282 | 22.6M | } _ZN9prevectorILj16EhjiEaSERKS0_ Line | Count | Source | 276 | 99.7k | prevector& operator=(const prevector<N, T, Size, Diff>& other) { | 277 | 99.7k | if (&other == this) { | 278 | 0 | return *this; | 279 | 0 | } | 280 | 99.7k | assign(other.begin(), other.end()); | 281 | 99.7k | return *this; | 282 | 99.7k | } |
_ZN9prevectorILj28EhjiEaSERKS0_ Line | Count | Source | 276 | 22.5M | prevector& operator=(const prevector<N, T, Size, Diff>& other) { | 277 | 22.5M | if (&other == this) { | 278 | 0 | return *this; | 279 | 0 | } | 280 | 22.5M | assign(other.begin(), other.end()); | 281 | 22.5M | return *this; | 282 | 22.5M | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiEaSERKS0_ |
283 | | |
284 | 29.9M | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { |
285 | 29.9M | if (!is_direct()) { |
286 | 0 | free(_union.indirect_contents.indirect); |
287 | 0 | } |
288 | 29.9M | _union = std::move(other._union); |
289 | 29.9M | _size = other._size; |
290 | 29.9M | other._size = 0; |
291 | 29.9M | return *this; |
292 | 29.9M | } Unexecuted instantiation: _ZN9prevectorILj16EhjiEaSEOS0_ _ZN9prevectorILj28EhjiEaSEOS0_ Line | Count | Source | 284 | 29.9M | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { | 285 | 29.9M | if (!is_direct()) { | 286 | 0 | free(_union.indirect_contents.indirect); | 287 | 0 | } | 288 | 29.9M | _union = std::move(other._union); | 289 | 29.9M | _size = other._size; | 290 | 29.9M | other._size = 0; | 291 | 29.9M | return *this; | 292 | 29.9M | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiEaSEOS0_ |
293 | | |
294 | 3.66G | size_type size() const { |
295 | 3.66G | return is_direct() ? _size2.65G : _size - N - 11.01G ; |
296 | 3.66G | } _ZNK9prevectorILj28EhjiE4sizeEv Line | Count | Source | 294 | 3.66G | size_type size() const { | 295 | 3.66G | return is_direct() ? _size2.64G : _size - N - 11.01G ; | 296 | 3.66G | } |
Unexecuted instantiation: _ZNK9prevectorILj33EhjiE4sizeEv _ZNK9prevectorILj16EhjiE4sizeEv Line | Count | Source | 294 | 8.99M | size_type size() const { | 295 | 8.99M | return is_direct() ? _size8.50M : _size - N - 1493k ; | 296 | 8.99M | } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE4sizeEv _ZNK9prevectorILj35EhjiE4sizeEv Line | Count | Source | 294 | 5.02k | size_type size() const { | 295 | 5.02k | return is_direct() ? _size : _size - N - 10 ; | 296 | 5.02k | } |
|
297 | | |
298 | 541M | bool empty() const { |
299 | 541M | return size() == 0; |
300 | 541M | } _ZNK9prevectorILj28EhjiE5emptyEv Line | Count | Source | 298 | 541M | bool empty() const { | 299 | 541M | return size() == 0; | 300 | 541M | } |
Unexecuted instantiation: _ZNK9prevectorILj16EhjiE5emptyEv Unexecuted instantiation: _ZNK9prevectorILj8EijiE5emptyEv |
301 | | |
302 | 140M | iterator begin() { return iterator(item_ptr(0)); } Unexecuted instantiation: _ZN9prevectorILj33EhjiE5beginEv _ZN9prevectorILj28EhjiE5beginEv Line | Count | Source | 302 | 140M | iterator begin() { return iterator(item_ptr(0)); } |
Unexecuted instantiation: _ZN9prevectorILj16EhjiE5beginEv Unexecuted instantiation: _ZN9prevectorILj8EijiE5beginEv _ZN9prevectorILj35EhjiE5beginEv Line | Count | Source | 302 | 1.43k | iterator begin() { return iterator(item_ptr(0)); } |
|
303 | 380M | const_iterator begin() const { return const_iterator(item_ptr(0)); } _ZNK9prevectorILj28EhjiE5beginEv Line | Count | Source | 303 | 377M | const_iterator begin() const { return const_iterator(item_ptr(0)); } |
_ZNK9prevectorILj16EhjiE5beginEv Line | Count | Source | 303 | 3.49M | const_iterator begin() const { return const_iterator(item_ptr(0)); } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE5beginEv |
304 | 141M | iterator end() { return iterator(item_ptr(size())); } _ZN9prevectorILj28EhjiE3endEv Line | Count | Source | 304 | 140M | iterator end() { return iterator(item_ptr(size())); } |
Unexecuted instantiation: _ZN9prevectorILj33EhjiE3endEv _ZN9prevectorILj16EhjiE3endEv Line | Count | Source | 304 | 785k | iterator end() { return iterator(item_ptr(size())); } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE3endEv _ZN9prevectorILj35EhjiE3endEv Line | Count | Source | 304 | 1.43k | iterator end() { return iterator(item_ptr(size())); } |
|
305 | 819M | const_iterator end() const { return const_iterator(item_ptr(size())); } _ZNK9prevectorILj28EhjiE3endEv Line | Count | Source | 305 | 817M | const_iterator end() const { return const_iterator(item_ptr(size())); } |
_ZNK9prevectorILj16EhjiE3endEv Line | Count | Source | 305 | 2.28M | const_iterator end() const { return const_iterator(item_ptr(size())); } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE3endEv |
306 | | |
307 | | reverse_iterator rbegin() { return reverse_iterator(item_ptr(size() - 1)); } |
308 | | const_reverse_iterator rbegin() const { return const_reverse_iterator(item_ptr(size() - 1)); } |
309 | | reverse_iterator rend() { return reverse_iterator(item_ptr(-1)); } |
310 | | const_reverse_iterator rend() const { return const_reverse_iterator(item_ptr(-1)); } |
311 | | |
312 | 149M | size_t capacity() const { |
313 | 149M | if (is_direct()) { |
314 | 115M | return N; |
315 | 115M | } else { |
316 | 34.3M | return _union.indirect_contents.capacity; |
317 | 34.3M | } |
318 | 149M | } _ZNK9prevectorILj28EhjiE8capacityEv Line | Count | Source | 312 | 149M | size_t capacity() const { | 313 | 149M | if (is_direct()) { | 314 | 115M | return N; | 315 | 115M | } else { | 316 | 34.3M | return _union.indirect_contents.capacity; | 317 | 34.3M | } | 318 | 149M | } |
_ZNK9prevectorILj16EhjiE8capacityEv Line | Count | Source | 312 | 327k | size_t capacity() const { | 313 | 327k | if (is_direct()) { | 314 | 327k | return N; | 315 | 327k | } else { | 316 | 0 | return _union.indirect_contents.capacity; | 317 | 0 | } | 318 | 327k | } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiE8capacityEv Unexecuted instantiation: _ZNK9prevectorILj33EhjiE8capacityEv _ZNK9prevectorILj35EhjiE8capacityEv Line | Count | Source | 312 | 1.43k | size_t capacity() const { | 313 | 1.43k | if (is_direct()) { | 314 | 1.43k | return N; | 315 | 1.43k | } else { | 316 | 0 | return _union.indirect_contents.capacity; | 317 | 0 | } | 318 | 1.43k | } |
|
319 | | |
320 | 71.4M | T& operator[](size_type pos) { |
321 | 71.4M | return *item_ptr(pos); |
322 | 71.4M | } _ZN9prevectorILj28EhjiEixEj Line | Count | Source | 320 | 71.4M | T& operator[](size_type pos) { | 321 | 71.4M | return *item_ptr(pos); | 322 | 71.4M | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiEixEj Unexecuted instantiation: _ZN9prevectorILj33EhjiEixEj Unexecuted instantiation: _ZN9prevectorILj16EhjiEixEj |
323 | | |
324 | 130M | const T& operator[](size_type pos) const { |
325 | 130M | return *item_ptr(pos); |
326 | 130M | } _ZNK9prevectorILj28EhjiEixEj Line | Count | Source | 324 | 129M | const T& operator[](size_type pos) const { | 325 | 129M | return *item_ptr(pos); | 326 | 129M | } |
_ZNK9prevectorILj16EhjiEixEj Line | Count | Source | 324 | 1.03M | const T& operator[](size_type pos) const { | 325 | 1.03M | return *item_ptr(pos); | 326 | 1.03M | } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiEixEj |
327 | | |
328 | 236M | void resize(size_type new_size) { |
329 | 236M | size_type cur_size = size(); |
330 | 236M | if (cur_size == new_size) { |
331 | 226M | return; |
332 | 226M | } |
333 | 10.4M | if (cur_size > new_size) { |
334 | 409k | erase(item_ptr(new_size), end()); |
335 | 409k | return; |
336 | 409k | } |
337 | 10.0M | if (new_size > capacity()) { |
338 | 10.0M | change_capacity(new_size); |
339 | 10.0M | } |
340 | 10.0M | ptrdiff_t increase = new_size - cur_size; |
341 | 10.0M | fill(item_ptr(cur_size), increase); |
342 | 10.0M | _size += increase; |
343 | 10.0M | } _ZN9prevectorILj28EhjiE6resizeEj Line | Count | Source | 328 | 236M | void resize(size_type new_size) { | 329 | 236M | size_type cur_size = size(); | 330 | 236M | if (cur_size == new_size) { | 331 | 226M | return; | 332 | 226M | } | 333 | 10.0M | if (cur_size > new_size) { | 334 | 16.8k | erase(item_ptr(new_size), end()); | 335 | 16.8k | return; | 336 | 16.8k | } | 337 | 9.99M | if (new_size > capacity()) { | 338 | 9.99M | change_capacity(new_size); | 339 | 9.99M | } | 340 | 9.99M | ptrdiff_t increase = new_size - cur_size; | 341 | 9.99M | fill(item_ptr(cur_size), increase); | 342 | 9.99M | _size += increase; | 343 | 9.99M | } |
_ZN9prevectorILj16EhjiE6resizeEj Line | Count | Source | 328 | 542k | void resize(size_type new_size) { | 329 | 542k | size_type cur_size = size(); | 330 | 542k | if (cur_size == new_size) { | 331 | 94.1k | return; | 332 | 94.1k | } | 333 | 448k | if (cur_size > new_size) { | 334 | 392k | erase(item_ptr(new_size), end()); | 335 | 392k | return; | 336 | 392k | } | 337 | 55.3k | if (new_size > capacity()) { | 338 | 55.3k | change_capacity(new_size); | 339 | 55.3k | } | 340 | 55.3k | ptrdiff_t increase = new_size - cur_size; | 341 | 55.3k | fill(item_ptr(cur_size), increase); | 342 | 55.3k | _size += increase; | 343 | 55.3k | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE6resizeEj Unexecuted instantiation: _ZN9prevectorILj33EhjiE6resizeEj |
344 | | |
345 | 0 | void reserve(size_type new_capacity) { |
346 | 0 | if (new_capacity > capacity()) { |
347 | 0 | change_capacity(new_capacity); |
348 | 0 | } |
349 | 0 | } Unexecuted instantiation: _ZN9prevectorILj28EhjiE7reserveEj Unexecuted instantiation: _ZN9prevectorILj8EijiE7reserveEj |
350 | | |
351 | 201M | void shrink_to_fit() { |
352 | 201M | change_capacity(size()); |
353 | 201M | } _ZN9prevectorILj28EhjiE13shrink_to_fitEv Line | Count | Source | 351 | 201M | void shrink_to_fit() { | 352 | 201M | change_capacity(size()); | 353 | 201M | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE13shrink_to_fitEv |
354 | | |
355 | 226M | void clear() { |
356 | 226M | resize(0); |
357 | 226M | } _ZN9prevectorILj28EhjiE5clearEv Line | Count | Source | 355 | 226M | void clear() { | 356 | 226M | resize(0); | 357 | 226M | } |
_ZN9prevectorILj16EhjiE5clearEv Line | Count | Source | 355 | 272k | void clear() { | 356 | 272k | resize(0); | 357 | 272k | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE5clearEv Unexecuted instantiation: _ZN9prevectorILj33EhjiE5clearEv |
358 | | |
359 | 66.3M | iterator insert(iterator pos, const T& value) { |
360 | 66.3M | size_type p = pos - begin(); |
361 | 66.3M | size_type new_size = size() + 1; |
362 | 66.3M | if (capacity() < new_size) { |
363 | 96.9k | change_capacity(new_size + (new_size >> 1)); |
364 | 96.9k | } |
365 | 66.3M | T* ptr = item_ptr(p); |
366 | 66.3M | T* dst = ptr + 1; |
367 | 66.3M | memmove(dst, ptr, (size() - p) * sizeof(T)); |
368 | 66.3M | _size++; |
369 | 66.3M | new(static_cast<void*>(ptr)) T(value); |
370 | 66.3M | return iterator(ptr); |
371 | 66.3M | } _ZN9prevectorILj28EhjiE6insertENS0_8iteratorERKh Line | Count | Source | 359 | 66.3M | iterator insert(iterator pos, const T& value) { | 360 | 66.3M | size_type p = pos - begin(); | 361 | 66.3M | size_type new_size = size() + 1; | 362 | 66.3M | if (capacity() < new_size) { | 363 | 96.9k | change_capacity(new_size + (new_size >> 1)); | 364 | 96.9k | } | 365 | 66.3M | T* ptr = item_ptr(p); | 366 | 66.3M | T* dst = ptr + 1; | 367 | 66.3M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 368 | 66.3M | _size++; | 369 | 66.3M | new(static_cast<void*>(ptr)) T(value); | 370 | 66.3M | return iterator(ptr); | 371 | 66.3M | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE6insertENS0_8iteratorERKi |
372 | | |
373 | 0 | void insert(iterator pos, size_type count, const T& value) { |
374 | 0 | size_type p = pos - begin(); |
375 | 0 | size_type new_size = size() + count; |
376 | 0 | if (capacity() < new_size) { |
377 | 0 | change_capacity(new_size + (new_size >> 1)); |
378 | 0 | } |
379 | 0 | T* ptr = item_ptr(p); |
380 | 0 | T* dst = ptr + count; |
381 | 0 | memmove(dst, ptr, (size() - p) * sizeof(T)); |
382 | 0 | _size += count; |
383 | 0 | fill(item_ptr(p), count, value); |
384 | 0 | } Unexecuted instantiation: _ZN9prevectorILj8EijiE6insertENS0_8iteratorEjRKi Unexecuted instantiation: _ZN9prevectorILj28EhjiE6insertENS0_8iteratorEjRKh |
385 | | |
386 | | template <std::input_iterator InputIterator> |
387 | 44.5M | void insert(iterator pos, InputIterator first, InputIterator last) { |
388 | 44.5M | size_type p = pos - begin(); |
389 | 44.5M | difference_type count = last - first; |
390 | 44.5M | size_type new_size = size() + count; |
391 | 44.5M | if (capacity() < new_size) { |
392 | 971k | change_capacity(new_size + (new_size >> 1)); |
393 | 971k | } |
394 | 44.5M | T* ptr = item_ptr(p); |
395 | 44.5M | T* dst = ptr + count; |
396 | 44.5M | memmove(dst, ptr, (size() - p) * sizeof(T)); |
397 | 44.5M | _size += count; |
398 | 44.5M | fill(ptr, first, last); |
399 | 44.5M | } Unexecuted instantiation: _ZN9prevectorILj28EhjiE6insertITkNSt3__114input_iteratorEPKhEEvNS0_8iteratorET_S6_ _ZN9prevectorILj28EhjiE6insertITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvNS0_8iteratorET_S8_ Line | Count | Source | 387 | 43.2M | void insert(iterator pos, InputIterator first, InputIterator last) { | 388 | 43.2M | size_type p = pos - begin(); | 389 | 43.2M | difference_type count = last - first; | 390 | 43.2M | size_type new_size = size() + count; | 391 | 43.2M | if (capacity() < new_size) { | 392 | 950k | change_capacity(new_size + (new_size >> 1)); | 393 | 950k | } | 394 | 43.2M | T* ptr = item_ptr(p); | 395 | 43.2M | T* dst = ptr + count; | 396 | 43.2M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 397 | 43.2M | _size += count; | 398 | 43.2M | fill(ptr, first, last); | 399 | 43.2M | } |
Unexecuted instantiation: _ZN9prevectorILj28EhjiE6insertITkNSt3__114input_iteratorENS0_8iteratorEEEvS3_T_S4_ Unexecuted instantiation: _ZN9prevectorILj8EijiE6insertITkNSt3__114input_iteratorEPiEEvNS0_8iteratorET_S5_ _ZN9prevectorILj28EhjiE6insertITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEEvNS0_8iteratorET_S7_ Line | Count | Source | 387 | 1.28M | void insert(iterator pos, InputIterator first, InputIterator last) { | 388 | 1.28M | size_type p = pos - begin(); | 389 | 1.28M | difference_type count = last - first; | 390 | 1.28M | size_type new_size = size() + count; | 391 | 1.28M | if (capacity() < new_size) { | 392 | 21.6k | change_capacity(new_size + (new_size >> 1)); | 393 | 21.6k | } | 394 | 1.28M | T* ptr = item_ptr(p); | 395 | 1.28M | T* dst = ptr + count; | 396 | 1.28M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 397 | 1.28M | _size += count; | 398 | 1.28M | fill(ptr, first, last); | 399 | 1.28M | } |
_ZN9prevectorILj35EhjiE6insertITkNSt3__114input_iteratorEPhEEvNS0_8iteratorET_S5_ Line | Count | Source | 387 | 718 | void insert(iterator pos, InputIterator first, InputIterator last) { | 388 | 718 | size_type p = pos - begin(); | 389 | 718 | difference_type count = last - first; | 390 | 718 | size_type new_size = size() + count; | 391 | 718 | if (capacity() < new_size) { | 392 | 0 | change_capacity(new_size + (new_size >> 1)); | 393 | 0 | } | 394 | 718 | T* ptr = item_ptr(p); | 395 | 718 | T* dst = ptr + count; | 396 | 718 | memmove(dst, ptr, (size() - p) * sizeof(T)); | 397 | 718 | _size += count; | 398 | 718 | fill(ptr, first, last); | 399 | 718 | } |
_ZN9prevectorILj35EhjiE6insertITkNSt3__114input_iteratorEPKhEEvNS0_8iteratorET_S6_ Line | Count | Source | 387 | 718 | void insert(iterator pos, InputIterator first, InputIterator last) { | 388 | 718 | size_type p = pos - begin(); | 389 | 718 | difference_type count = last - first; | 390 | 718 | size_type new_size = size() + count; | 391 | 718 | if (capacity() < new_size) { | 392 | 0 | change_capacity(new_size + (new_size >> 1)); | 393 | 0 | } | 394 | 718 | T* ptr = item_ptr(p); | 395 | 718 | T* dst = ptr + count; | 396 | 718 | memmove(dst, ptr, (size() - p) * sizeof(T)); | 397 | 718 | _size += count; | 398 | 718 | fill(ptr, first, last); | 399 | 718 | } |
Unexecuted instantiation: _ZN9prevectorILj28EhjiE6insertITkNSt3__114input_iteratorENS0_14const_iteratorEEEvNS0_8iteratorET_S5_ |
400 | | |
401 | 1.50M | inline void resize_uninitialized(size_type new_size) { |
402 | | // resize_uninitialized changes the size of the prevector but does not initialize it. |
403 | | // If size < new_size, the added elements must be initialized explicitly. |
404 | 1.50M | if (capacity() < new_size) { |
405 | 1.09M | change_capacity(new_size); |
406 | 1.09M | _size += new_size - size(); |
407 | 1.09M | return; |
408 | 1.09M | } |
409 | 410k | if (new_size < size()) { |
410 | 0 | erase(item_ptr(new_size), end()); |
411 | 410k | } else { |
412 | 410k | _size += new_size - size(); |
413 | 410k | } |
414 | 410k | } _ZN9prevectorILj28EhjiE20resize_uninitializedEj Line | Count | Source | 401 | 1.50M | inline void resize_uninitialized(size_type new_size) { | 402 | | // resize_uninitialized changes the size of the prevector but does not initialize it. | 403 | | // If size < new_size, the added elements must be initialized explicitly. | 404 | 1.50M | if (capacity() < new_size) { | 405 | 1.09M | change_capacity(new_size); | 406 | 1.09M | _size += new_size - size(); | 407 | 1.09M | return; | 408 | 1.09M | } | 409 | 410k | if (new_size < size()) { | 410 | 0 | erase(item_ptr(new_size), end()); | 411 | 410k | } else { | 412 | 410k | _size += new_size - size(); | 413 | 410k | } | 414 | 410k | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE20resize_uninitializedEj |
415 | | |
416 | 0 | iterator erase(iterator pos) { |
417 | 0 | return erase(pos, pos + 1); |
418 | 0 | } Unexecuted instantiation: _ZN9prevectorILj8EijiE5eraseENS0_8iteratorE Unexecuted instantiation: _ZN9prevectorILj33EhjiE5eraseENS0_8iteratorE |
419 | | |
420 | 409k | iterator erase(iterator first, iterator last) { |
421 | | // Erase is not allowed to the change the object's capacity. That means |
422 | | // that when starting with an indirectly allocated prevector with |
423 | | // size and capacity > N, the result may be a still indirectly allocated |
424 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is |
425 | | // necessary to switch to the (more efficient) directly allocated |
426 | | // representation (with capacity N and size <= N). |
427 | 409k | iterator p = first; |
428 | 409k | char* endp = (char*)&(*end()); |
429 | 409k | _size -= last - p; |
430 | 409k | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); |
431 | 409k | return first; |
432 | 409k | } _ZN9prevectorILj28EhjiE5eraseENS0_8iteratorES1_ Line | Count | Source | 420 | 16.8k | iterator erase(iterator first, iterator last) { | 421 | | // Erase is not allowed to the change the object's capacity. That means | 422 | | // that when starting with an indirectly allocated prevector with | 423 | | // size and capacity > N, the result may be a still indirectly allocated | 424 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 425 | | // necessary to switch to the (more efficient) directly allocated | 426 | | // representation (with capacity N and size <= N). | 427 | 16.8k | iterator p = first; | 428 | 16.8k | char* endp = (char*)&(*end()); | 429 | 16.8k | _size -= last - p; | 430 | 16.8k | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 431 | 16.8k | return first; | 432 | 16.8k | } |
_ZN9prevectorILj16EhjiE5eraseENS0_8iteratorES1_ Line | Count | Source | 420 | 392k | iterator erase(iterator first, iterator last) { | 421 | | // Erase is not allowed to the change the object's capacity. That means | 422 | | // that when starting with an indirectly allocated prevector with | 423 | | // size and capacity > N, the result may be a still indirectly allocated | 424 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 425 | | // necessary to switch to the (more efficient) directly allocated | 426 | | // representation (with capacity N and size <= N). | 427 | 392k | iterator p = first; | 428 | 392k | char* endp = (char*)&(*end()); | 429 | 392k | _size -= last - p; | 430 | 392k | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 431 | 392k | return first; | 432 | 392k | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE5eraseENS0_8iteratorES1_ Unexecuted instantiation: _ZN9prevectorILj33EhjiE5eraseENS0_8iteratorES1_ |
433 | | |
434 | | template<typename... Args> |
435 | 4.53M | void emplace_back(Args&&... args) { |
436 | 4.53M | size_type new_size = size() + 1; |
437 | 4.53M | if (capacity() < new_size) { |
438 | 2.33k | change_capacity(new_size + (new_size >> 1)); |
439 | 2.33k | } |
440 | 4.53M | new(item_ptr(size())) T(std::forward<Args>(args)...); |
441 | 4.53M | _size++; |
442 | 4.53M | } _ZN9prevectorILj28EhjiE12emplace_backIJRKhEEEvDpOT_ Line | Count | Source | 435 | 4.53M | void emplace_back(Args&&... args) { | 436 | 4.53M | size_type new_size = size() + 1; | 437 | 4.53M | if (capacity() < new_size) { | 438 | 2.33k | change_capacity(new_size + (new_size >> 1)); | 439 | 2.33k | } | 440 | 4.53M | new(item_ptr(size())) T(std::forward<Args>(args)...); | 441 | 4.53M | _size++; | 442 | 4.53M | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE12emplace_backIJRKiEEEvDpOT_ |
443 | | |
444 | 4.53M | void push_back(const T& value) { |
445 | 4.53M | emplace_back(value); |
446 | 4.53M | } _ZN9prevectorILj28EhjiE9push_backERKh Line | Count | Source | 444 | 4.53M | void push_back(const T& value) { | 445 | 4.53M | emplace_back(value); | 446 | 4.53M | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiE9push_backERKi |
447 | | |
448 | 0 | void pop_back() { |
449 | 0 | erase(end() - 1, end()); |
450 | 0 | } |
451 | | |
452 | | T& front() { |
453 | | return *item_ptr(0); |
454 | | } |
455 | | |
456 | | const T& front() const { |
457 | | return *item_ptr(0); |
458 | | } |
459 | | |
460 | 0 | T& back() { |
461 | 0 | return *item_ptr(size() - 1); |
462 | 0 | } |
463 | | |
464 | 0 | const T& back() const { |
465 | 0 | return *item_ptr(size() - 1); |
466 | 0 | } |
467 | | |
468 | | void swap(prevector<N, T, Size, Diff>& other) noexcept |
469 | 0 | { |
470 | 0 | std::swap(_union, other._union); |
471 | 0 | std::swap(_size, other._size); |
472 | 0 | } |
473 | | |
474 | 426M | ~prevector() { |
475 | 426M | if (!is_direct()) { |
476 | 56.0M | free(_union.indirect_contents.indirect); |
477 | 56.0M | _union.indirect_contents.indirect = nullptr; |
478 | 56.0M | } |
479 | 426M | } _ZN9prevectorILj16EhjiED2Ev Line | Count | Source | 474 | 3.15M | ~prevector() { | 475 | 3.15M | if (!is_direct()) { | 476 | 254k | free(_union.indirect_contents.indirect); | 477 | 254k | _union.indirect_contents.indirect = nullptr; | 478 | 254k | } | 479 | 3.15M | } |
_ZN9prevectorILj28EhjiED2Ev Line | Count | Source | 474 | 423M | ~prevector() { | 475 | 423M | if (!is_direct()) { | 476 | 55.7M | free(_union.indirect_contents.indirect); | 477 | 55.7M | _union.indirect_contents.indirect = nullptr; | 478 | 55.7M | } | 479 | 423M | } |
_ZN9prevectorILj33EhjiED2Ev Line | Count | Source | 474 | 103k | ~prevector() { | 475 | 103k | if (!is_direct()) { | 476 | 0 | free(_union.indirect_contents.indirect); | 477 | 0 | _union.indirect_contents.indirect = nullptr; | 478 | 0 | } | 479 | 103k | } |
Unexecuted instantiation: _ZN9prevectorILj8EijiED2Ev _ZN9prevectorILj35EhjiED2Ev Line | Count | Source | 474 | 718 | ~prevector() { | 475 | 718 | if (!is_direct()) { | 476 | 0 | free(_union.indirect_contents.indirect); | 477 | 0 | _union.indirect_contents.indirect = nullptr; | 478 | 0 | } | 479 | 718 | } |
|
480 | | |
481 | 186k | bool operator==(const prevector<N, T, Size, Diff>& other) const { |
482 | 186k | if (other.size() != size()) { |
483 | 0 | return false; |
484 | 0 | } |
485 | 186k | const_iterator b1 = begin(); |
486 | 186k | const_iterator b2 = other.begin(); |
487 | 186k | const_iterator e1 = end(); |
488 | 308k | while (b1 != e1) { |
489 | 306k | if ((*b1) != (*b2)) { |
490 | 184k | return false; |
491 | 184k | } |
492 | 122k | ++b1; |
493 | 122k | ++b2; |
494 | 122k | } |
495 | 1.91k | return true; |
496 | 186k | } _ZNK9prevectorILj28EhjiEeqERKS0_ Line | Count | Source | 481 | 55 | bool operator==(const prevector<N, T, Size, Diff>& other) const { | 482 | 55 | if (other.size() != size()) { | 483 | 0 | return false; | 484 | 0 | } | 485 | 55 | const_iterator b1 = begin(); | 486 | 55 | const_iterator b2 = other.begin(); | 487 | 55 | const_iterator e1 = end(); | 488 | 110 | while (b1 != e1) { | 489 | 55 | if ((*b1) != (*b2)) { | 490 | 0 | return false; | 491 | 0 | } | 492 | 55 | ++b1; | 493 | 55 | ++b2; | 494 | 55 | } | 495 | 55 | return true; | 496 | 55 | } |
Unexecuted instantiation: _ZNK9prevectorILj8EijiEeqERKS0_ _ZNK9prevectorILj16EhjiEeqERKS0_ Line | Count | Source | 481 | 186k | bool operator==(const prevector<N, T, Size, Diff>& other) const { | 482 | 186k | if (other.size() != size()) { | 483 | 0 | return false; | 484 | 0 | } | 485 | 186k | const_iterator b1 = begin(); | 486 | 186k | const_iterator b2 = other.begin(); | 487 | 186k | const_iterator e1 = end(); | 488 | 308k | while (b1 != e1) { | 489 | 306k | if ((*b1) != (*b2)) { | 490 | 184k | return false; | 491 | 184k | } | 492 | 122k | ++b1; | 493 | 122k | ++b2; | 494 | 122k | } | 495 | 1.85k | return true; | 496 | 186k | } |
|
497 | | |
498 | 0 | bool operator!=(const prevector<N, T, Size, Diff>& other) const { |
499 | 0 | return !(*this == other); |
500 | 0 | } |
501 | | |
502 | 0 | bool operator<(const prevector<N, T, Size, Diff>& other) const { |
503 | 0 | if (size() < other.size()) { |
504 | 0 | return true; |
505 | 0 | } |
506 | 0 | if (size() > other.size()) { |
507 | 0 | return false; |
508 | 0 | } |
509 | 0 | const_iterator b1 = begin(); |
510 | 0 | const_iterator b2 = other.begin(); |
511 | 0 | const_iterator e1 = end(); |
512 | 0 | while (b1 != e1) { |
513 | 0 | if ((*b1) < (*b2)) { |
514 | 0 | return true; |
515 | 0 | } |
516 | 0 | if ((*b2) < (*b1)) { |
517 | 0 | return false; |
518 | 0 | } |
519 | 0 | ++b1; |
520 | 0 | ++b2; |
521 | 0 | } |
522 | 0 | return false; |
523 | 0 | } Unexecuted instantiation: _ZNK9prevectorILj28EhjiEltERKS0_ Unexecuted instantiation: _ZNK9prevectorILj16EhjiEltERKS0_ |
524 | | |
525 | 29.9M | size_t allocated_memory() const { |
526 | 29.9M | if (is_direct()) { |
527 | 29.9M | return 0; |
528 | 29.9M | } else { |
529 | 0 | return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity; |
530 | 0 | } |
531 | 29.9M | } |
532 | | |
533 | 303k | value_type* data() { |
534 | 303k | return item_ptr(0); |
535 | 303k | } Unexecuted instantiation: _ZN9prevectorILj33EhjiE4dataEv _ZN9prevectorILj28EhjiE4dataEv Line | Count | Source | 533 | 33.0k | value_type* data() { | 534 | 33.0k | return item_ptr(0); | 535 | 33.0k | } |
_ZN9prevectorILj16EhjiE4dataEv Line | Count | Source | 533 | 270k | value_type* data() { | 534 | 270k | return item_ptr(0); | 535 | 270k | } |
_ZN9prevectorILj35EhjiE4dataEv Line | Count | Source | 533 | 718 | value_type* data() { | 534 | 718 | return item_ptr(0); | 535 | 718 | } |
|
536 | | |
537 | 537M | const value_type* data() const { |
538 | 537M | return item_ptr(0); |
539 | 537M | } _ZNK9prevectorILj28EhjiE4dataEv Line | Count | Source | 537 | 536M | const value_type* data() const { | 538 | 536M | return item_ptr(0); | 539 | 536M | } |
_ZNK9prevectorILj16EhjiE4dataEv Line | Count | Source | 537 | 1.24M | const value_type* data() const { | 538 | 1.24M | return item_ptr(0); | 539 | 1.24M | } |
Unexecuted instantiation: _ZNK9prevectorILj33EhjiE4dataEv |
540 | | }; |
541 | | |
542 | | #endif // BITCOIN_PREVECTOR_H |