/root/bitcoin/src/prevector.h
Line | Count | Source |
1 | | // Copyright (c) 2015-present 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 | | static constexpr unsigned int STATIC_SIZE{N}; |
42 | | |
43 | | typedef Size size_type; |
44 | | typedef Diff difference_type; |
45 | | typedef T value_type; |
46 | | typedef value_type& reference; |
47 | | typedef const value_type& const_reference; |
48 | | typedef value_type* pointer; |
49 | | typedef const value_type* const_pointer; |
50 | | |
51 | | class iterator { |
52 | | T* ptr{}; |
53 | | public: |
54 | | typedef Diff difference_type; |
55 | | typedef T* pointer; |
56 | | typedef T& reference; |
57 | | using element_type = T; |
58 | | using iterator_category = std::contiguous_iterator_tag; |
59 | | iterator() = default; |
60 | 219M | iterator(T* ptr_) : ptr(ptr_) {} _ZN9prevectorILj16EhjiE8iteratorC2EPh Line | Count | Source | 60 | 32.6M | iterator(T* ptr_) : ptr(ptr_) {} |
_ZN9prevectorILj36EhjiE8iteratorC2EPh Line | Count | Source | 60 | 186M | iterator(T* ptr_) : ptr(ptr_) {} |
_ZN9prevectorILj8EijiE8iteratorC2EPi Line | Count | Source | 60 | 192k | iterator(T* ptr_) : ptr(ptr_) {} |
_ZN9prevectorILj33EhjiE8iteratorC2EPh Line | Count | Source | 60 | 42 | iterator(T* ptr_) : ptr(ptr_) {} |
_ZN9prevectorILj35EhjiE8iteratorC2EPh Line | Count | Source | 60 | 154k | iterator(T* ptr_) : ptr(ptr_) {} |
|
61 | 499M | T& operator*() const { return *ptr; } _ZNK9prevectorILj36EhjiE8iteratordeEv Line | Count | Source | 61 | 433M | T& operator*() const { return *ptr; } |
_ZNK9prevectorILj16EhjiE8iteratordeEv Line | Count | Source | 61 | 65.3M | T& operator*() const { return *ptr; } |
_ZNK9prevectorILj8EijiE8iteratordeEv Line | Count | Source | 61 | 228k | T& operator*() const { return *ptr; } |
_ZNK9prevectorILj33EhjiE8iteratordeEv Line | Count | Source | 61 | 84 | T& operator*() const { return *ptr; } |
_ZNK9prevectorILj35EhjiE8iteratordeEv Line | Count | Source | 61 | 154k | T& operator*() const { return *ptr; } |
|
62 | 0 | T* operator->() const { return ptr; } Unexecuted instantiation: _ZNK9prevectorILj33EhjiE8iteratorptEv Unexecuted instantiation: _ZNK9prevectorILj36EhjiE8iteratorptEv Unexecuted instantiation: _ZNK9prevectorILj16EhjiE8iteratorptEv Unexecuted instantiation: _ZNK9prevectorILj35EhjiE8iteratorptEv |
63 | | T& operator[](size_type pos) const { return ptr[pos]; } |
64 | 277M | iterator& operator++() { ptr++; return *this; } |
65 | | iterator& operator--() { ptr--; return *this; } |
66 | | iterator operator++(int) { iterator copy(*this); ++(*this); return copy; } |
67 | | iterator operator--(int) { iterator copy(*this); --(*this); return copy; } |
68 | 87.7M | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } _ZmiN9prevectorILj36EhjiE8iteratorES1_ Line | Count | Source | 68 | 76.7M | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
_ZmiN9prevectorILj16EhjiE8iteratorES1_ Line | Count | Source | 68 | 10.8M | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
_ZmiN9prevectorILj8EijiE8iteratorES1_ Line | Count | Source | 68 | 54.5k | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
_ZmiN9prevectorILj33EhjiE8iteratorES1_ Line | Count | Source | 68 | 14 | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
_ZmiN9prevectorILj35EhjiE8iteratorES1_ Line | Count | Source | 68 | 77.0k | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
|
69 | 40.6k | iterator operator+(size_type n) const { return iterator(ptr + n); } _ZNK9prevectorILj36EhjiE8iteratorplEj Line | Count | Source | 69 | 256 | iterator operator+(size_type n) const { return iterator(ptr + n); } |
_ZNK9prevectorILj8EijiE8iteratorplEj Line | Count | Source | 69 | 40.3k | iterator operator+(size_type n) const { return iterator(ptr + n); } |
_ZNK9prevectorILj33EhjiE8iteratorplEj Line | Count | Source | 69 | 14 | iterator operator+(size_type n) const { return iterator(ptr + n); } |
|
70 | | iterator friend operator+(size_type n, iterator x) { return x + n; } |
71 | | iterator& operator+=(size_type n) { ptr += n; return *this; } |
72 | 4.01k | iterator operator-(size_type n) const { return iterator(ptr - n); } |
73 | | iterator& operator-=(size_type n) { ptr -= n; return *this; } |
74 | | bool operator==(iterator x) const { return ptr == x.ptr; } |
75 | 279M | 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 | | bool operator>(iterator x) const { return ptr > x.ptr; } |
79 | | bool operator<(iterator x) const { return ptr < x.ptr; } |
80 | | }; |
81 | | |
82 | | class const_iterator { |
83 | | const T* ptr{}; |
84 | | public: |
85 | | typedef Diff difference_type; |
86 | | typedef const T* pointer; |
87 | | typedef const T& reference; |
88 | | using element_type = const T; |
89 | | using iterator_category = std::contiguous_iterator_tag; |
90 | | const_iterator() = default; |
91 | 4.65G | const_iterator(const T* ptr_) : ptr(ptr_) {} _ZN9prevectorILj16EhjiE14const_iteratorC2EPKh Line | Count | Source | 91 | 1.30G | const_iterator(const T* ptr_) : ptr(ptr_) {} |
_ZN9prevectorILj36EhjiE14const_iteratorC2EPKh Line | Count | Source | 91 | 3.34G | const_iterator(const T* ptr_) : ptr(ptr_) {} |
_ZN9prevectorILj8EijiE14const_iteratorC2EPKi Line | Count | Source | 91 | 3.00M | const_iterator(const T* ptr_) : ptr(ptr_) {} |
|
92 | 781k | const_iterator(iterator x) : ptr(&(*x)) {} |
93 | 59.2G | const T& operator*() const { return *ptr; } _ZNK9prevectorILj36EhjiE14const_iteratordeEv Line | Count | Source | 93 | 52.3G | const T& operator*() const { return *ptr; } |
_ZNK9prevectorILj16EhjiE14const_iteratordeEv Line | Count | Source | 93 | 6.86G | const T& operator*() const { return *ptr; } |
_ZNK9prevectorILj8EijiE14const_iteratordeEv Line | Count | Source | 93 | 37.5M | const T& operator*() const { return *ptr; } |
|
94 | 0 | const T* operator->() const { return ptr; } Unexecuted instantiation: _ZNK9prevectorILj36EhjiE14const_iteratorptEv Unexecuted instantiation: _ZNK9prevectorILj16EhjiE14const_iteratorptEv |
95 | 936k | const T& operator[](size_type pos) const { return ptr[pos]; } _ZNK9prevectorILj8EijiE14const_iteratorixEj Line | Count | Source | 95 | 497k | const T& operator[](size_type pos) const { return ptr[pos]; } |
_ZNK9prevectorILj36EhjiE14const_iteratorixEj Line | Count | Source | 95 | 438k | const T& operator[](size_type pos) const { return ptr[pos]; } |
|
96 | 56.1G | const_iterator& operator++() { ptr++; return *this; } _ZN9prevectorILj36EhjiE14const_iteratorppEv Line | Count | Source | 96 | 50.1G | const_iterator& operator++() { ptr++; return *this; } |
_ZN9prevectorILj16EhjiE14const_iteratorppEv Line | Count | Source | 96 | 5.93G | const_iterator& operator++() { ptr++; return *this; } |
_ZN9prevectorILj8EijiE14const_iteratorppEv Line | Count | Source | 96 | 35.5M | const_iterator& operator++() { ptr++; return *this; } |
|
97 | 1.99M | const_iterator& operator--() { ptr--; return *this; } _ZN9prevectorILj8EijiE14const_iteratormmEv Line | Count | Source | 97 | 1.99M | const_iterator& operator--() { ptr--; return *this; } |
Unexecuted instantiation: _ZN9prevectorILj36EhjiE14const_iteratormmEv |
98 | 293M | const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; } |
99 | | const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; } |
100 | 1.09G | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } _ZmiN9prevectorILj16EhjiE14const_iteratorES1_ Line | Count | Source | 100 | 59.6M | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } |
_ZmiN9prevectorILj36EhjiE14const_iteratorES1_ Line | Count | Source | 100 | 1.03G | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } |
_ZmiN9prevectorILj8EijiE14const_iteratorES1_ Line | Count | Source | 100 | 9.29k | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } |
|
101 | 72.0M | const_iterator operator+(size_type n) const { return const_iterator(ptr + n); } _ZNK9prevectorILj8EijiE14const_iteratorplEj Line | Count | Source | 101 | 995k | const_iterator operator+(size_type n) const { return const_iterator(ptr + n); } |
_ZNK9prevectorILj36EhjiE14const_iteratorplEj Line | Count | Source | 101 | 71.0M | const_iterator operator+(size_type n) const { return const_iterator(ptr + n); } |
|
102 | | const_iterator friend operator+(size_type n, const_iterator x) { return x + n; } |
103 | 99.5M | const_iterator& operator+=(size_type n) { ptr += n; return *this; } |
104 | 710k | const_iterator operator-(size_type n) const { return const_iterator(ptr - n); } _ZNK9prevectorILj8EijiE14const_iteratormiEj Line | Count | Source | 104 | 497k | const_iterator operator-(size_type n) const { return const_iterator(ptr - n); } |
_ZNK9prevectorILj36EhjiE14const_iteratormiEj Line | Count | Source | 104 | 212k | const_iterator operator-(size_type n) const { return const_iterator(ptr - n); } |
|
105 | | const_iterator& operator-=(size_type n) { ptr -= n; return *this; } |
106 | 1.07M | bool operator==(const_iterator x) const { return ptr == x.ptr; } _ZNK9prevectorILj8EijiE14const_iteratoreqES1_ Line | Count | Source | 106 | 995k | bool operator==(const_iterator x) const { return ptr == x.ptr; } |
_ZNK9prevectorILj16EhjiE14const_iteratoreqES1_ Line | Count | Source | 106 | 190 | bool operator==(const_iterator x) const { return ptr == x.ptr; } |
_ZNK9prevectorILj36EhjiE14const_iteratoreqES1_ Line | Count | Source | 106 | 80.9k | bool operator==(const_iterator x) const { return ptr == x.ptr; } |
|
107 | 56.9G | bool operator!=(const_iterator x) const { return ptr != x.ptr; } _ZNK9prevectorILj36EhjiE14const_iteratorneES1_ Line | Count | Source | 107 | 51.2G | bool operator!=(const_iterator x) const { return ptr != x.ptr; } |
_ZNK9prevectorILj16EhjiE14const_iteratorneES1_ Line | Count | Source | 107 | 5.66G | bool operator!=(const_iterator x) const { return ptr != x.ptr; } |
_ZNK9prevectorILj8EijiE14const_iteratorneES1_ Line | Count | Source | 107 | 34.5M | bool operator!=(const_iterator x) const { return ptr != x.ptr; } |
|
108 | 280M | bool operator>=(const_iterator x) const { return ptr >= x.ptr; } |
109 | | bool operator<=(const_iterator x) const { return ptr <= x.ptr; } |
110 | | bool operator>(const_iterator x) const { return ptr > x.ptr; } |
111 | 171M | bool operator<(const_iterator x) const { return ptr < x.ptr; } |
112 | | }; |
113 | | |
114 | | private: |
115 | | #pragma pack(push, 1) |
116 | | union direct_or_indirect { |
117 | | char direct[sizeof(T) * N]; |
118 | | struct { |
119 | | char* indirect; |
120 | | size_type capacity; |
121 | | } indirect_contents; |
122 | | }; |
123 | | #pragma pack(pop) |
124 | | alignas(char*) direct_or_indirect _union = {}; |
125 | | size_type _size = 0; |
126 | | |
127 | | static_assert(alignof(char*) % alignof(size_type) == 0 && sizeof(char*) % alignof(size_type) == 0, "size_type cannot have more restrictive alignment requirement than pointer"); |
128 | | static_assert(alignof(char*) % alignof(T) == 0, "value_type T cannot have more restrictive alignment requirement than pointer"); |
129 | | |
130 | 1.66G | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } _ZN9prevectorILj36EhjiE10direct_ptrEi Line | Count | Source | 130 | 1.38G | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
_ZN9prevectorILj33EhjiE10direct_ptrEi Line | Count | Source | 130 | 1.34M | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
_ZN9prevectorILj16EhjiE10direct_ptrEi Line | Count | Source | 130 | 278M | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
_ZN9prevectorILj8EijiE10direct_ptrEi Line | Count | Source | 130 | 68.5k | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
_ZN9prevectorILj35EhjiE10direct_ptrEi Line | Count | Source | 130 | 308k | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
|
131 | 6.29G | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } _ZNK9prevectorILj36EhjiE10direct_ptrEi Line | Count | Source | 131 | 4.37G | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
_ZNK9prevectorILj16EhjiE10direct_ptrEi Line | Count | Source | 131 | 1.92G | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
_ZNK9prevectorILj8EijiE10direct_ptrEi Line | Count | Source | 131 | 12.7k | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
_ZNK9prevectorILj33EhjiE10direct_ptrEi Line | Count | Source | 131 | 293k | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
|
132 | 278M | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } _ZN9prevectorILj36EhjiE12indirect_ptrEi Line | Count | Source | 132 | 199M | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } |
_ZN9prevectorILj33EhjiE12indirect_ptrEi Line | Count | Source | 132 | 509 | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } |
_ZN9prevectorILj16EhjiE12indirect_ptrEi Line | Count | Source | 132 | 78.7M | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } |
_ZN9prevectorILj8EijiE12indirect_ptrEi Line | Count | Source | 132 | 150k | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } |
Unexecuted instantiation: _ZN9prevectorILj35EhjiE12indirect_ptrEi |
133 | 670M | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } _ZNK9prevectorILj36EhjiE12indirect_ptrEi Line | Count | Source | 133 | 390M | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } |
_ZNK9prevectorILj16EhjiE12indirect_ptrEi Line | Count | Source | 133 | 276M | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } |
_ZNK9prevectorILj8EijiE12indirect_ptrEi Line | Count | Source | 133 | 3.49M | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } |
_ZNK9prevectorILj33EhjiE12indirect_ptrEi Line | Count | Source | 133 | 166 | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } |
|
134 | 36.2G | bool is_direct() const { return _size <= N; } _ZNK9prevectorILj36EhjiE9is_directEv Line | Count | Source | 134 | 31.6G | bool is_direct() const { return _size <= N; } |
_ZNK9prevectorILj33EhjiE9is_directEv Line | Count | Source | 134 | 5.27M | bool is_direct() const { return _size <= N; } |
_ZNK9prevectorILj16EhjiE9is_directEv Line | Count | Source | 134 | 4.57G | bool is_direct() const { return _size <= N; } |
_ZNK9prevectorILj8EijiE9is_directEv Line | Count | Source | 134 | 4.49M | bool is_direct() const { return _size <= N; } |
_ZNK9prevectorILj35EhjiE9is_directEv Line | Count | Source | 134 | 731k | bool is_direct() const { return _size <= N; } |
|
135 | | |
136 | 1.17G | void change_capacity(size_type new_capacity) { |
137 | 1.17G | if (new_capacity <= N) { |
138 | 1.09G | if (!is_direct()) { |
139 | 26.1k | T* indirect = indirect_ptr(0); |
140 | 26.1k | T* src = indirect; |
141 | 26.1k | T* dst = direct_ptr(0); |
142 | 26.1k | memcpy(dst, src, size() * sizeof(T)); |
143 | 26.1k | free(indirect); |
144 | 26.1k | _size -= N + 1; |
145 | 26.1k | } |
146 | 1.09G | } else { |
147 | 78.4M | if (!is_direct()) { |
148 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert |
149 | | success. These should instead use an allocator or new/delete so that handlers |
150 | | are called as necessary, but performance would be slightly degraded by doing so. */ |
151 | 549k | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); |
152 | 549k | assert(_union.indirect_contents.indirect); |
153 | 549k | _union.indirect_contents.capacity = new_capacity; |
154 | 77.8M | } else { |
155 | 77.8M | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); |
156 | 77.8M | assert(new_indirect); |
157 | 77.8M | T* src = direct_ptr(0); |
158 | 77.8M | T* dst = reinterpret_cast<T*>(new_indirect); |
159 | 77.8M | memcpy(dst, src, size() * sizeof(T)); |
160 | 77.8M | _union.indirect_contents.indirect = new_indirect; |
161 | 77.8M | _union.indirect_contents.capacity = new_capacity; |
162 | 77.8M | _size += N + 1; |
163 | 77.8M | } |
164 | 78.4M | } |
165 | 1.17G | } _ZN9prevectorILj36EhjiE15change_capacityEj Line | Count | Source | 136 | 942M | void change_capacity(size_type new_capacity) { | 137 | 942M | if (new_capacity <= N) { | 138 | 935M | if (!is_direct()) { | 139 | 25.4k | T* indirect = indirect_ptr(0); | 140 | 25.4k | T* src = indirect; | 141 | 25.4k | T* dst = direct_ptr(0); | 142 | 25.4k | memcpy(dst, src, size() * sizeof(T)); | 143 | 25.4k | free(indirect); | 144 | 25.4k | _size -= N + 1; | 145 | 25.4k | } | 146 | 935M | } else { | 147 | 7.04M | if (!is_direct()) { | 148 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 149 | | success. These should instead use an allocator or new/delete so that handlers | 150 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 151 | 542k | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 152 | 542k | assert(_union.indirect_contents.indirect); | 153 | 542k | _union.indirect_contents.capacity = new_capacity; | 154 | 6.49M | } else { | 155 | 6.49M | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 156 | 6.49M | assert(new_indirect); | 157 | 6.49M | T* src = direct_ptr(0); | 158 | 6.49M | T* dst = reinterpret_cast<T*>(new_indirect); | 159 | 6.49M | memcpy(dst, src, size() * sizeof(T)); | 160 | 6.49M | _union.indirect_contents.indirect = new_indirect; | 161 | 6.49M | _union.indirect_contents.capacity = new_capacity; | 162 | 6.49M | _size += N + 1; | 163 | 6.49M | } | 164 | 7.04M | } | 165 | 942M | } |
_ZN9prevectorILj16EhjiE15change_capacityEj Line | Count | Source | 136 | 227M | void change_capacity(size_type new_capacity) { | 137 | 227M | if (new_capacity <= N) { | 138 | 155M | if (!is_direct()) { | 139 | 0 | T* indirect = indirect_ptr(0); | 140 | 0 | T* src = indirect; | 141 | 0 | T* dst = direct_ptr(0); | 142 | 0 | memcpy(dst, src, size() * sizeof(T)); | 143 | 0 | free(indirect); | 144 | 0 | _size -= N + 1; | 145 | 0 | } | 146 | 155M | } else { | 147 | 71.3M | if (!is_direct()) { | 148 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 149 | | success. These should instead use an allocator or new/delete so that handlers | 150 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 151 | 0 | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 152 | 0 | assert(_union.indirect_contents.indirect); | 153 | 0 | _union.indirect_contents.capacity = new_capacity; | 154 | 71.3M | } else { | 155 | 71.3M | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 156 | 71.3M | assert(new_indirect); | 157 | 71.3M | T* src = direct_ptr(0); | 158 | 71.3M | T* dst = reinterpret_cast<T*>(new_indirect); | 159 | 71.3M | memcpy(dst, src, size() * sizeof(T)); | 160 | 71.3M | _union.indirect_contents.indirect = new_indirect; | 161 | 71.3M | _union.indirect_contents.capacity = new_capacity; | 162 | 71.3M | _size += N + 1; | 163 | 71.3M | } | 164 | 71.3M | } | 165 | 227M | } |
_ZN9prevectorILj33EhjiE15change_capacityEj Line | Count | Source | 136 | 293k | void change_capacity(size_type new_capacity) { | 137 | 293k | if (new_capacity <= N) { | 138 | 293k | if (!is_direct()) { | 139 | 0 | T* indirect = indirect_ptr(0); | 140 | 0 | T* src = indirect; | 141 | 0 | T* dst = direct_ptr(0); | 142 | 0 | memcpy(dst, src, size() * sizeof(T)); | 143 | 0 | free(indirect); | 144 | 0 | _size -= N + 1; | 145 | 0 | } | 146 | 293k | } else { | 147 | 509 | if (!is_direct()) { | 148 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 149 | | success. These should instead use an allocator or new/delete so that handlers | 150 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 151 | 0 | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 152 | 0 | assert(_union.indirect_contents.indirect); | 153 | 0 | _union.indirect_contents.capacity = new_capacity; | 154 | 509 | } else { | 155 | 509 | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 156 | 509 | assert(new_indirect); | 157 | 509 | T* src = direct_ptr(0); | 158 | 509 | T* dst = reinterpret_cast<T*>(new_indirect); | 159 | 509 | memcpy(dst, src, size() * sizeof(T)); | 160 | 509 | _union.indirect_contents.indirect = new_indirect; | 161 | 509 | _union.indirect_contents.capacity = new_capacity; | 162 | 509 | _size += N + 1; | 163 | 509 | } | 164 | 509 | } | 165 | 293k | } |
_ZN9prevectorILj8EijiE15change_capacityEj Line | Count | Source | 136 | 15.5k | void change_capacity(size_type new_capacity) { | 137 | 15.5k | if (new_capacity <= N) { | 138 | 4.17k | if (!is_direct()) { | 139 | 755 | T* indirect = indirect_ptr(0); | 140 | 755 | T* src = indirect; | 141 | 755 | T* dst = direct_ptr(0); | 142 | 755 | memcpy(dst, src, size() * sizeof(T)); | 143 | 755 | free(indirect); | 144 | 755 | _size -= N + 1; | 145 | 755 | } | 146 | 11.3k | } else { | 147 | 11.3k | if (!is_direct()) { | 148 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 149 | | success. These should instead use an allocator or new/delete so that handlers | 150 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 151 | 6.32k | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 152 | 6.32k | assert(_union.indirect_contents.indirect); | 153 | 6.32k | _union.indirect_contents.capacity = new_capacity; | 154 | 6.32k | } else { | 155 | 5.03k | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 156 | 5.03k | assert(new_indirect); | 157 | 5.03k | T* src = direct_ptr(0); | 158 | 5.03k | T* dst = reinterpret_cast<T*>(new_indirect); | 159 | 5.03k | memcpy(dst, src, size() * sizeof(T)); | 160 | 5.03k | _union.indirect_contents.indirect = new_indirect; | 161 | 5.03k | _union.indirect_contents.capacity = new_capacity; | 162 | 5.03k | _size += N + 1; | 163 | 5.03k | } | 164 | 11.3k | } | 165 | 15.5k | } |
_ZN9prevectorILj35EhjiE15change_capacityEj Line | Count | Source | 136 | 38.5k | void change_capacity(size_type new_capacity) { | 137 | 38.5k | if (new_capacity <= N) { | 138 | 38.5k | if (!is_direct()) { | 139 | 0 | T* indirect = indirect_ptr(0); | 140 | 0 | T* src = indirect; | 141 | 0 | T* dst = direct_ptr(0); | 142 | 0 | memcpy(dst, src, size() * sizeof(T)); | 143 | 0 | free(indirect); | 144 | 0 | _size -= N + 1; | 145 | 0 | } | 146 | 38.5k | } else { | 147 | 0 | if (!is_direct()) { | 148 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 149 | | success. These should instead use an allocator or new/delete so that handlers | 150 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 151 | 0 | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 152 | 0 | assert(_union.indirect_contents.indirect); | 153 | 0 | _union.indirect_contents.capacity = new_capacity; | 154 | 0 | } else { | 155 | 0 | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 156 | 0 | assert(new_indirect); | 157 | 0 | T* src = direct_ptr(0); | 158 | 0 | T* dst = reinterpret_cast<T*>(new_indirect); | 159 | 0 | memcpy(dst, src, size() * sizeof(T)); | 160 | 0 | _union.indirect_contents.indirect = new_indirect; | 161 | 0 | _union.indirect_contents.capacity = new_capacity; | 162 | 0 | _size += N + 1; | 163 | 0 | } | 164 | 0 | } | 165 | 38.5k | } |
|
166 | | |
167 | 1.86G | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } _ZN9prevectorILj36EhjiE8item_ptrEi Line | Count | Source | 167 | 1.57G | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
_ZN9prevectorILj33EhjiE8item_ptrEi Line | Count | Source | 167 | 1.34M | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
_ZN9prevectorILj16EhjiE8item_ptrEi Line | Count | Source | 167 | 285M | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
_ZN9prevectorILj8EijiE8item_ptrEi Line | Count | Source | 167 | 212k | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
_ZN9prevectorILj35EhjiE8item_ptrEi Line | Count | Source | 167 | 308k | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
|
168 | 6.97G | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } _ZNK9prevectorILj36EhjiE8item_ptrEi Line | Count | Source | 168 | 4.76G | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
_ZNK9prevectorILj16EhjiE8item_ptrEi Line | Count | Source | 168 | 2.20G | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
_ZNK9prevectorILj8EijiE8item_ptrEi Line | Count | Source | 168 | 3.50M | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
_ZNK9prevectorILj33EhjiE8item_ptrEi Line | Count | Source | 168 | 293k | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
|
169 | | |
170 | 64.0M | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { |
171 | 64.0M | std::fill_n(dst, count, value); |
172 | 64.0M | } _ZN9prevectorILj36EhjiE4fillEPhlRKh Line | Count | Source | 170 | 4.58M | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 171 | 4.58M | std::fill_n(dst, count, value); | 172 | 4.58M | } |
_ZN9prevectorILj16EhjiE4fillEPhlRKh Line | Count | Source | 170 | 58.9M | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 171 | 58.9M | std::fill_n(dst, count, value); | 172 | 58.9M | } |
_ZN9prevectorILj33EhjiE4fillEPhlRKh Line | Count | Source | 170 | 483k | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 171 | 483k | std::fill_n(dst, count, value); | 172 | 483k | } |
_ZN9prevectorILj8EijiE4fillEPilRKi Line | Count | Source | 170 | 19.7k | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 171 | 19.7k | std::fill_n(dst, count, value); | 172 | 19.7k | } |
|
173 | | |
174 | | template <std::input_iterator InputIterator> |
175 | 1.54G | void fill(T* dst, InputIterator first, InputIterator last) { |
176 | 55.8G | while (first != last) { |
177 | 54.2G | new(static_cast<void*>(dst)) T(*first); |
178 | 54.2G | ++dst; |
179 | 54.2G | ++first; |
180 | 54.2G | } |
181 | 1.54G | } _ZN9prevectorILj36EhjiE4fillITkSt14input_iteratorPKhEEvPhT_S5_ Line | Count | Source | 175 | 19.3k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 70.9k | while (first != last) { | 177 | 51.5k | new(static_cast<void*>(dst)) T(*first); | 178 | 51.5k | ++dst; | 179 | 51.5k | ++first; | 180 | 51.5k | } | 181 | 19.3k | } |
_ZN9prevectorILj36EhjiE4fillITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt4spanIS4_Lm18446744073709551615EEEEEEvPhT_SA_ Line | Count | Source | 175 | 14.9M | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 2.02G | while (first != last) { | 177 | 2.01G | new(static_cast<void*>(dst)) T(*first); | 178 | 2.01G | ++dst; | 179 | 2.01G | ++first; | 180 | 2.01G | } | 181 | 14.9M | } |
_ZN9prevectorILj36EhjiE4fillITkSt14input_iteratorNS0_14const_iteratorEEEvPhT_S4_ Line | Count | Source | 175 | 1.34G | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 49.5G | while (first != last) { | 177 | 48.1G | new(static_cast<void*>(dst)) T(*first); | 178 | 48.1G | ++dst; | 179 | 48.1G | ++first; | 180 | 48.1G | } | 181 | 1.34G | } |
_ZN9prevectorILj16EhjiE4fillITkSt14input_iteratorNS0_14const_iteratorEEEvPhT_S4_ Line | Count | Source | 175 | 172M | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 3.61G | while (first != last) { | 177 | 3.44G | new(static_cast<void*>(dst)) T(*first); | 178 | 3.44G | ++dst; | 179 | 3.44G | ++first; | 180 | 3.44G | } | 181 | 172M | } |
_ZN9prevectorILj36EhjiE4fillITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEEvPhT_SB_ Line | Count | Source | 175 | 3.07M | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 33.5M | while (first != last) { | 177 | 30.4M | new(static_cast<void*>(dst)) T(*first); | 178 | 30.4M | ++dst; | 179 | 30.4M | ++first; | 180 | 30.4M | } | 181 | 3.07M | } |
_ZN9prevectorILj36EhjiE4fillITkSt14input_iteratorNS0_8iteratorEEEvPhT_S4_ Line | Count | Source | 175 | 1.06M | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 268M | while (first != last) { | 177 | 267M | new(static_cast<void*>(dst)) T(*first); | 178 | 267M | ++dst; | 179 | 267M | ++first; | 180 | 267M | } | 181 | 1.06M | } |
_ZN9prevectorILj8EijiE4fillITkSt14input_iteratorPiEEvS2_T_S3_ Line | Count | Source | 175 | 5.19k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 16.0k | while (first != last) { | 177 | 10.8k | new(static_cast<void*>(dst)) T(*first); | 178 | 10.8k | ++dst; | 179 | 10.8k | ++first; | 180 | 10.8k | } | 181 | 5.19k | } |
_ZN9prevectorILj8EijiE4fillITkSt14input_iteratorNS0_14const_iteratorEEEvPiT_S4_ Line | Count | Source | 175 | 9.29k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 32.1M | while (first != last) { | 177 | 32.0M | new(static_cast<void*>(dst)) T(*first); | 178 | 32.0M | ++dst; | 179 | 32.0M | ++first; | 180 | 32.0M | } | 181 | 9.29k | } |
_ZN9prevectorILj8EijiE4fillITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEEEEvPiT_SB_ Line | Count | Source | 175 | 147 | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 497k | while (first != last) { | 177 | 497k | new(static_cast<void*>(dst)) T(*first); | 178 | 497k | ++dst; | 179 | 497k | ++first; | 180 | 497k | } | 181 | 147 | } |
_ZN9prevectorILj33EhjiE4fillITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEEvPhT_SB_ Line | Count | Source | 175 | 2.09k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 356k | while (first != last) { | 177 | 354k | new(static_cast<void*>(dst)) T(*first); | 178 | 354k | ++dst; | 179 | 354k | ++first; | 180 | 354k | } | 181 | 2.09k | } |
_ZN9prevectorILj36EhjiE4fillITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEEEvS4_T_S9_ Line | Count | Source | 175 | 3.02M | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 279M | while (first != last) { | 177 | 276M | new(static_cast<void*>(dst)) T(*first); | 178 | 276M | ++dst; | 179 | 276M | ++first; | 180 | 276M | } | 181 | 3.02M | } |
_ZN9prevectorILj16EhjiE4fillITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt4spanIS4_Lm18446744073709551615EEEEEEvPhT_SA_ Line | Count | Source | 175 | 443k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 7.56M | while (first != last) { | 177 | 7.12M | new(static_cast<void*>(dst)) T(*first); | 178 | 7.12M | ++dst; | 179 | 7.12M | ++first; | 180 | 7.12M | } | 181 | 443k | } |
_ZN9prevectorILj16EhjiE4fillITkSt14input_iteratorPhEEvS2_T_S3_ Line | Count | Source | 175 | 1.40M | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 15.4M | while (first != last) { | 177 | 14.0M | new(static_cast<void*>(dst)) T(*first); | 178 | 14.0M | ++dst; | 179 | 14.0M | ++first; | 180 | 14.0M | } | 181 | 1.40M | } |
_ZN9prevectorILj16EhjiE4fillITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEEEvS4_T_S9_ Line | Count | Source | 175 | 15.5k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 512k | while (first != last) { | 177 | 497k | new(static_cast<void*>(dst)) T(*first); | 178 | 497k | ++dst; | 179 | 497k | ++first; | 180 | 497k | } | 181 | 15.5k | } |
_ZN9prevectorILj16EhjiE4fillITkSt14input_iteratorPKhEEvPhT_S5_ Line | Count | Source | 175 | 31.4k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 157k | while (first != last) { | 177 | 125k | new(static_cast<void*>(dst)) T(*first); | 178 | 125k | ++dst; | 179 | 125k | ++first; | 180 | 125k | } | 181 | 31.4k | } |
_ZN9prevectorILj35EhjiE4fillITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt4spanIS4_Lm18446744073709551615EEEEEEvPhT_SA_ Line | Count | Source | 175 | 38.5k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 1.27M | while (first != last) { | 177 | 1.23M | new(static_cast<void*>(dst)) T(*first); | 178 | 1.23M | ++dst; | 179 | 1.23M | ++first; | 180 | 1.23M | } | 181 | 38.5k | } |
_ZN9prevectorILj35EhjiE4fillITkSt14input_iteratorPhEEvS2_T_S3_ Line | Count | Source | 175 | 38.5k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 115k | while (first != last) { | 177 | 77.0k | new(static_cast<void*>(dst)) T(*first); | 178 | 77.0k | ++dst; | 179 | 77.0k | ++first; | 180 | 77.0k | } | 181 | 38.5k | } |
_ZN9prevectorILj35EhjiE4fillITkSt14input_iteratorPKhEEvPhT_S5_ Line | Count | Source | 175 | 38.5k | void fill(T* dst, InputIterator first, InputIterator last) { | 176 | 77.0k | while (first != last) { | 177 | 38.5k | new(static_cast<void*>(dst)) T(*first); | 178 | 38.5k | ++dst; | 179 | 38.5k | ++first; | 180 | 38.5k | } | 181 | 38.5k | } |
|
182 | | |
183 | | public: |
184 | 506k | void assign(size_type n, const T& val) { |
185 | 506k | clear(); |
186 | 506k | if (capacity() < n) { |
187 | 2.36k | change_capacity(n); |
188 | 2.36k | } |
189 | 506k | _size += n; |
190 | 506k | fill(item_ptr(0), n, val); |
191 | 506k | } _ZN9prevectorILj16EhjiE6assignEjRKh Line | Count | Source | 184 | 498k | void assign(size_type n, const T& val) { | 185 | 498k | clear(); | 186 | 498k | if (capacity() < n) { | 187 | 0 | change_capacity(n); | 188 | 0 | } | 189 | 498k | _size += n; | 190 | 498k | fill(item_ptr(0), n, val); | 191 | 498k | } |
_ZN9prevectorILj8EijiE6assignEjRKi Line | Count | Source | 184 | 8.21k | void assign(size_type n, const T& val) { | 185 | 8.21k | clear(); | 186 | 8.21k | if (capacity() < n) { | 187 | 2.36k | change_capacity(n); | 188 | 2.36k | } | 189 | 8.21k | _size += n; | 190 | 8.21k | fill(item_ptr(0), n, val); | 191 | 8.21k | } |
|
192 | | |
193 | | template <std::input_iterator InputIterator> |
194 | 432M | void assign(InputIterator first, InputIterator last) { |
195 | 432M | size_type n = last - first; |
196 | 432M | clear(); |
197 | 432M | if (capacity() < n) { |
198 | 2.23M | change_capacity(n); |
199 | 2.23M | } |
200 | 432M | _size += n; |
201 | 432M | fill(item_ptr(0), first, last); |
202 | 432M | } _ZN9prevectorILj16EhjiE6assignITkSt14input_iteratorNS0_14const_iteratorEEEvT_S3_ Line | Count | Source | 194 | 5.24M | void assign(InputIterator first, InputIterator last) { | 195 | 5.24M | size_type n = last - first; | 196 | 5.24M | clear(); | 197 | 5.24M | if (capacity() < n) { | 198 | 1.89M | change_capacity(n); | 199 | 1.89M | } | 200 | 5.24M | _size += n; | 201 | 5.24M | fill(item_ptr(0), first, last); | 202 | 5.24M | } |
_ZN9prevectorILj36EhjiE6assignITkSt14input_iteratorNS0_14const_iteratorEEEvT_S3_ Line | Count | Source | 194 | 424M | void assign(InputIterator first, InputIterator last) { | 195 | 424M | size_type n = last - first; | 196 | 424M | clear(); | 197 | 424M | if (capacity() < n) { | 198 | 325k | change_capacity(n); | 199 | 325k | } | 200 | 424M | _size += n; | 201 | 424M | fill(item_ptr(0), first, last); | 202 | 424M | } |
_ZN9prevectorILj8EijiE6assignITkSt14input_iteratorNS0_14const_iteratorEEEvT_S3_ Line | Count | Source | 194 | 9.14k | void assign(InputIterator first, InputIterator last) { | 195 | 9.14k | size_type n = last - first; | 196 | 9.14k | clear(); | 197 | 9.14k | if (capacity() < n) { | 198 | 1.30k | change_capacity(n); | 199 | 1.30k | } | 200 | 9.14k | _size += n; | 201 | 9.14k | fill(item_ptr(0), first, last); | 202 | 9.14k | } |
_ZN9prevectorILj33EhjiE6assignITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEEvT_SA_ Line | Count | Source | 194 | 2.09k | void assign(InputIterator first, InputIterator last) { | 195 | 2.09k | size_type n = last - first; | 196 | 2.09k | clear(); | 197 | 2.09k | if (capacity() < n) { | 198 | 509 | change_capacity(n); | 199 | 509 | } | 200 | 2.09k | _size += n; | 201 | 2.09k | fill(item_ptr(0), first, last); | 202 | 2.09k | } |
_ZN9prevectorILj16EhjiE6assignITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt4spanIS4_Lm18446744073709551615EEEEEEvT_S9_ Line | Count | Source | 194 | 443k | void assign(InputIterator first, InputIterator last) { | 195 | 443k | size_type n = last - first; | 196 | 443k | clear(); | 197 | 443k | if (capacity() < n) { | 198 | 4.23k | change_capacity(n); | 199 | 4.23k | } | 200 | 443k | _size += n; | 201 | 443k | fill(item_ptr(0), first, last); | 202 | 443k | } |
_ZN9prevectorILj16EhjiE6assignITkSt14input_iteratorPhEEvT_S3_ Line | Count | Source | 194 | 1.40M | void assign(InputIterator first, InputIterator last) { | 195 | 1.40M | size_type n = last - first; | 196 | 1.40M | clear(); | 197 | 1.40M | if (capacity() < n) { | 198 | 0 | change_capacity(n); | 199 | 0 | } | 200 | 1.40M | _size += n; | 201 | 1.40M | fill(item_ptr(0), first, last); | 202 | 1.40M | } |
_ZN9prevectorILj16EhjiE6assignITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEEEvT_S9_ Line | Count | Source | 194 | 15.5k | void assign(InputIterator first, InputIterator last) { | 195 | 15.5k | size_type n = last - first; | 196 | 15.5k | clear(); | 197 | 15.5k | if (capacity() < n) { | 198 | 15.5k | change_capacity(n); | 199 | 15.5k | } | 200 | 15.5k | _size += n; | 201 | 15.5k | fill(item_ptr(0), first, last); | 202 | 15.5k | } |
_ZN9prevectorILj16EhjiE6assignITkSt14input_iteratorPKhEEvT_S4_ Line | Count | Source | 194 | 31.4k | void assign(InputIterator first, InputIterator last) { | 195 | 31.4k | size_type n = last - first; | 196 | 31.4k | clear(); | 197 | 31.4k | if (capacity() < n) { | 198 | 0 | change_capacity(n); | 199 | 0 | } | 200 | 31.4k | _size += n; | 201 | 31.4k | fill(item_ptr(0), first, last); | 202 | 31.4k | } |
|
203 | | |
204 | 525M | prevector() = default; _ZN9prevectorILj36EhjiEC2Ev Line | Count | Source | 204 | 523M | prevector() = default; |
_ZN9prevectorILj33EhjiEC2Ev Line | Count | Source | 204 | 2.17M | prevector() = default; |
_ZN9prevectorILj8EijiEC2Ev Line | Count | Source | 204 | 294 | prevector() = default; |
|
205 | | |
206 | | explicit prevector(size_type n) { |
207 | | resize(n); |
208 | | } |
209 | | |
210 | 51.4M | explicit prevector(size_type n, const T& val) { |
211 | 51.4M | change_capacity(n); |
212 | 51.4M | _size += n; |
213 | 51.4M | fill(item_ptr(0), n, val); |
214 | 51.4M | } _ZN9prevectorILj33EhjiEC2EjRKh Line | Count | Source | 210 | 293k | explicit prevector(size_type n, const T& val) { | 211 | 293k | change_capacity(n); | 212 | 293k | _size += n; | 213 | 293k | fill(item_ptr(0), n, val); | 214 | 293k | } |
_ZN9prevectorILj16EhjiEC2EjRKh Line | Count | Source | 210 | 51.1M | explicit prevector(size_type n, const T& val) { | 211 | 51.1M | change_capacity(n); | 212 | 51.1M | _size += n; | 213 | 51.1M | fill(item_ptr(0), n, val); | 214 | 51.1M | } |
|
215 | | |
216 | | template <std::input_iterator InputIterator> |
217 | 3.43M | prevector(InputIterator first, InputIterator last) { |
218 | 3.43M | size_type n = last - first; |
219 | 3.43M | change_capacity(n); |
220 | 3.43M | _size += n; |
221 | 3.43M | fill(item_ptr(0), first, last); |
222 | 3.43M | } _ZN9prevectorILj36EhjiEC2ITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEET_SA_ Line | Count | Source | 217 | 3.07M | prevector(InputIterator first, InputIterator last) { | 218 | 3.07M | size_type n = last - first; | 219 | 3.07M | change_capacity(n); | 220 | 3.07M | _size += n; | 221 | 3.07M | fill(item_ptr(0), first, last); | 222 | 3.07M | } |
_ZN9prevectorILj8EijiEC2ITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEEEET_SA_ Line | Count | Source | 217 | 147 | prevector(InputIterator first, InputIterator last) { | 218 | 147 | size_type n = last - first; | 219 | 147 | change_capacity(n); | 220 | 147 | _size += n; | 221 | 147 | fill(item_ptr(0), first, last); | 222 | 147 | } |
_ZN9prevectorILj8EijiEC2ITkSt14input_iteratorNS0_14const_iteratorEEET_S3_ Line | Count | Source | 217 | 147 | prevector(InputIterator first, InputIterator last) { | 218 | 147 | size_type n = last - first; | 219 | 147 | change_capacity(n); | 220 | 147 | _size += n; | 221 | 147 | fill(item_ptr(0), first, last); | 222 | 147 | } |
_ZN9prevectorILj36EhjiEC2ITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEEET_S9_ Line | Count | Source | 217 | 47.4k | prevector(InputIterator first, InputIterator last) { | 218 | 47.4k | size_type n = last - first; | 219 | 47.4k | change_capacity(n); | 220 | 47.4k | _size += n; | 221 | 47.4k | fill(item_ptr(0), first, last); | 222 | 47.4k | } |
_ZN9prevectorILj35EhjiEC2ITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt4spanIS4_Lm18446744073709551615EEEEEET_S9_ Line | Count | Source | 217 | 38.5k | prevector(InputIterator first, InputIterator last) { | 218 | 38.5k | size_type n = last - first; | 219 | 38.5k | change_capacity(n); | 220 | 38.5k | _size += n; | 221 | 38.5k | fill(item_ptr(0), first, last); | 222 | 38.5k | } |
_ZN9prevectorILj36EhjiEC2ITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt4spanIS4_Lm18446744073709551615EEEEEET_S9_ Line | Count | Source | 217 | 1.48k | prevector(InputIterator first, InputIterator last) { | 218 | 1.48k | size_type n = last - first; | 219 | 1.48k | change_capacity(n); | 220 | 1.48k | _size += n; | 221 | 1.48k | fill(item_ptr(0), first, last); | 222 | 1.48k | } |
_ZN9prevectorILj36EhjiEC2ITkSt14input_iteratorNS0_14const_iteratorEEET_S3_ Line | Count | Source | 217 | 271k | prevector(InputIterator first, InputIterator last) { | 218 | 271k | size_type n = last - first; | 219 | 271k | change_capacity(n); | 220 | 271k | _size += n; | 221 | 271k | fill(item_ptr(0), first, last); | 222 | 271k | } |
|
223 | | |
224 | 1.06G | prevector(const prevector<N, T, Size, Diff>& other) { |
225 | 1.06G | size_type n = other.size(); |
226 | 1.06G | change_capacity(n); |
227 | 1.06G | _size += n; |
228 | 1.06G | fill(item_ptr(0), other.begin(), other.end()); |
229 | 1.06G | } _ZN9prevectorILj16EhjiEC2ERKS0_ Line | Count | Source | 224 | 166M | prevector(const prevector<N, T, Size, Diff>& other) { | 225 | 166M | size_type n = other.size(); | 226 | 166M | change_capacity(n); | 227 | 166M | _size += n; | 228 | 166M | fill(item_ptr(0), other.begin(), other.end()); | 229 | 166M | } |
_ZN9prevectorILj36EhjiEC2ERKS0_ Line | Count | Source | 224 | 896M | prevector(const prevector<N, T, Size, Diff>& other) { | 225 | 896M | size_type n = other.size(); | 226 | 896M | change_capacity(n); | 227 | 896M | _size += n; | 228 | 896M | fill(item_ptr(0), other.begin(), other.end()); | 229 | 896M | } |
|
230 | | |
231 | | prevector(prevector<N, T, Size, Diff>&& other) noexcept |
232 | 623M | : _union(std::move(other._union)), _size(other._size) |
233 | 623M | { |
234 | 623M | other._size = 0; |
235 | 623M | } _ZN9prevectorILj16EhjiEC2EOS0_ Line | Count | Source | 232 | 7.17M | : _union(std::move(other._union)), _size(other._size) | 233 | 7.17M | { | 234 | 7.17M | other._size = 0; | 235 | 7.17M | } |
_ZN9prevectorILj36EhjiEC2EOS0_ Line | Count | Source | 232 | 616M | : _union(std::move(other._union)), _size(other._size) | 233 | 616M | { | 234 | 616M | other._size = 0; | 235 | 616M | } |
|
236 | | |
237 | 430M | prevector& operator=(const prevector<N, T, Size, Diff>& other) { |
238 | 430M | if (&other == this) { |
239 | 0 | return *this; |
240 | 0 | } |
241 | 430M | assign(other.begin(), other.end()); |
242 | 430M | return *this; |
243 | 430M | } _ZN9prevectorILj16EhjiEaSERKS0_ Line | Count | Source | 237 | 5.24M | prevector& operator=(const prevector<N, T, Size, Diff>& other) { | 238 | 5.24M | if (&other == this) { | 239 | 0 | return *this; | 240 | 0 | } | 241 | 5.24M | assign(other.begin(), other.end()); | 242 | 5.24M | return *this; | 243 | 5.24M | } |
_ZN9prevectorILj36EhjiEaSERKS0_ Line | Count | Source | 237 | 424M | prevector& operator=(const prevector<N, T, Size, Diff>& other) { | 238 | 424M | if (&other == this) { | 239 | 0 | return *this; | 240 | 0 | } | 241 | 424M | assign(other.begin(), other.end()); | 242 | 424M | return *this; | 243 | 424M | } |
_ZN9prevectorILj8EijiEaSERKS0_ Line | Count | Source | 237 | 9.14k | prevector& operator=(const prevector<N, T, Size, Diff>& other) { | 238 | 9.14k | if (&other == this) { | 239 | 0 | return *this; | 240 | 0 | } | 241 | 9.14k | assign(other.begin(), other.end()); | 242 | 9.14k | return *this; | 243 | 9.14k | } |
|
244 | | |
245 | 39.6M | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { |
246 | 39.6M | if (!is_direct()) { |
247 | 281k | free(_union.indirect_contents.indirect); |
248 | 281k | } |
249 | 39.6M | _union = std::move(other._union); |
250 | 39.6M | _size = other._size; |
251 | 39.6M | other._size = 0; |
252 | 39.6M | return *this; |
253 | 39.6M | } _ZN9prevectorILj16EhjiEaSEOS0_ Line | Count | Source | 245 | 24.3M | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { | 246 | 24.3M | if (!is_direct()) { | 247 | 5.10k | free(_union.indirect_contents.indirect); | 248 | 5.10k | } | 249 | 24.3M | _union = std::move(other._union); | 250 | 24.3M | _size = other._size; | 251 | 24.3M | other._size = 0; | 252 | 24.3M | return *this; | 253 | 24.3M | } |
_ZN9prevectorILj36EhjiEaSEOS0_ Line | Count | Source | 245 | 15.2M | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { | 246 | 15.2M | if (!is_direct()) { | 247 | 272k | free(_union.indirect_contents.indirect); | 248 | 272k | } | 249 | 15.2M | _union = std::move(other._union); | 250 | 15.2M | _size = other._size; | 251 | 15.2M | other._size = 0; | 252 | 15.2M | return *this; | 253 | 15.2M | } |
_ZN9prevectorILj8EijiEaSEOS0_ Line | Count | Source | 245 | 9.01k | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { | 246 | 9.01k | if (!is_direct()) { | 247 | 4.01k | free(_union.indirect_contents.indirect); | 248 | 4.01k | } | 249 | 9.01k | _union = std::move(other._union); | 250 | 9.01k | _size = other._size; | 251 | 9.01k | other._size = 0; | 252 | 9.01k | return *this; | 253 | 9.01k | } |
|
254 | | |
255 | 23.3G | size_type size() const { |
256 | 23.3G | return is_direct() ? _size : _size - N - 1; |
257 | 23.3G | } _ZNK9prevectorILj36EhjiE4sizeEv Line | Count | Source | 255 | 21.7G | size_type size() const { | 256 | 21.7G | return is_direct() ? _size : _size - N - 1; | 257 | 21.7G | } |
_ZNK9prevectorILj33EhjiE4sizeEv Line | Count | Source | 255 | 678k | size_type size() const { | 256 | 678k | return is_direct() ? _size : _size - N - 1; | 257 | 678k | } |
_ZNK9prevectorILj16EhjiE4sizeEv Line | Count | Source | 255 | 1.59G | size_type size() const { | 256 | 1.59G | return is_direct() ? _size : _size - N - 1; | 257 | 1.59G | } |
_ZNK9prevectorILj8EijiE4sizeEv Line | Count | Source | 255 | 689k | size_type size() const { | 256 | 689k | return is_direct() ? _size : _size - N - 1; | 257 | 689k | } |
_ZNK9prevectorILj35EhjiE4sizeEv Line | Count | Source | 255 | 269k | size_type size() const { | 256 | 269k | return is_direct() ? _size : _size - N - 1; | 257 | 269k | } |
|
258 | | |
259 | 8.34G | bool empty() const { |
260 | 8.34G | return size() == 0; |
261 | 8.34G | } _ZNK9prevectorILj36EhjiE5emptyEv Line | Count | Source | 259 | 8.33G | bool empty() const { | 260 | 8.33G | return size() == 0; | 261 | 8.33G | } |
_ZNK9prevectorILj16EhjiE5emptyEv Line | Count | Source | 259 | 11.3M | bool empty() const { | 260 | 11.3M | return size() == 0; | 261 | 11.3M | } |
_ZNK9prevectorILj8EijiE5emptyEv Line | Count | Source | 259 | 147 | bool empty() const { | 260 | 147 | return size() == 0; | 261 | 147 | } |
|
262 | | |
263 | 77.1M | iterator begin() { return iterator(item_ptr(0)); } _ZN9prevectorILj33EhjiE5beginEv Line | Count | Source | 263 | 14 | iterator begin() { return iterator(item_ptr(0)); } |
_ZN9prevectorILj36EhjiE5beginEv Line | Count | Source | 263 | 76.9M | iterator begin() { return iterator(item_ptr(0)); } |
Unexecuted instantiation: _ZN9prevectorILj16EhjiE5beginEv _ZN9prevectorILj8EijiE5beginEv Line | Count | Source | 263 | 62.5k | iterator begin() { return iterator(item_ptr(0)); } |
_ZN9prevectorILj35EhjiE5beginEv Line | Count | Source | 263 | 77.0k | iterator begin() { return iterator(item_ptr(0)); } |
|
264 | 2.51G | const_iterator begin() const { return const_iterator(item_ptr(0)); } _ZNK9prevectorILj36EhjiE5beginEv Line | Count | Source | 264 | 1.46G | const_iterator begin() const { return const_iterator(item_ptr(0)); } |
_ZNK9prevectorILj16EhjiE5beginEv Line | Count | Source | 264 | 1.04G | const_iterator begin() const { return const_iterator(item_ptr(0)); } |
_ZNK9prevectorILj8EijiE5beginEv Line | Count | Source | 264 | 1.00M | const_iterator begin() const { return const_iterator(item_ptr(0)); } |
|
265 | 99.7M | iterator end() { return iterator(item_ptr(size())); } _ZN9prevectorILj36EhjiE3endEv Line | Count | Source | 265 | 77.8M | iterator end() { return iterator(item_ptr(size())); } |
_ZN9prevectorILj33EhjiE3endEv Line | Count | Source | 265 | 14 | iterator end() { return iterator(item_ptr(size())); } |
_ZN9prevectorILj16EhjiE3endEv Line | Count | Source | 265 | 21.7M | iterator end() { return iterator(item_ptr(size())); } |
_ZN9prevectorILj8EijiE3endEv Line | Count | Source | 265 | 55.7k | iterator end() { return iterator(item_ptr(size())); } |
_ZN9prevectorILj35EhjiE3endEv Line | Count | Source | 265 | 77.0k | iterator end() { return iterator(item_ptr(size())); } |
|
266 | 2.07G | const_iterator end() const { return const_iterator(item_ptr(size())); } _ZNK9prevectorILj36EhjiE3endEv Line | Count | Source | 266 | 1.81G | const_iterator end() const { return const_iterator(item_ptr(size())); } |
_ZNK9prevectorILj16EhjiE3endEv Line | Count | Source | 266 | 261M | const_iterator end() const { return const_iterator(item_ptr(size())); } |
_ZNK9prevectorILj8EijiE3endEv Line | Count | Source | 266 | 508k | const_iterator end() const { return const_iterator(item_ptr(size())); } |
|
267 | | |
268 | 526M | size_t capacity() const { |
269 | 526M | if (is_direct()) { |
270 | 462M | return N; |
271 | 462M | } else { |
272 | 63.4M | return _union.indirect_contents.capacity; |
273 | 63.4M | } |
274 | 526M | } _ZNK9prevectorILj36EhjiE8capacityEv Line | Count | Source | 268 | 511M | size_t capacity() const { | 269 | 511M | if (is_direct()) { | 270 | 447M | return N; | 271 | 447M | } else { | 272 | 63.4M | return _union.indirect_contents.capacity; | 273 | 63.4M | } | 274 | 511M | } |
_ZNK9prevectorILj16EhjiE8capacityEv Line | Count | Source | 268 | 14.9M | size_t capacity() const { | 269 | 14.9M | if (is_direct()) { | 270 | 14.9M | return N; | 271 | 14.9M | } else { | 272 | 25.2k | return _union.indirect_contents.capacity; | 273 | 25.2k | } | 274 | 14.9M | } |
_ZNK9prevectorILj8EijiE8capacityEv Line | Count | Source | 268 | 62.5k | size_t capacity() const { | 269 | 62.5k | if (is_direct()) { | 270 | 24.7k | return N; | 271 | 37.8k | } else { | 272 | 37.8k | return _union.indirect_contents.capacity; | 273 | 37.8k | } | 274 | 62.5k | } |
_ZNK9prevectorILj33EhjiE8capacityEv Line | Count | Source | 268 | 192k | size_t capacity() const { | 269 | 192k | if (is_direct()) { | 270 | 192k | return N; | 271 | 192k | } else { | 272 | 0 | return _union.indirect_contents.capacity; | 273 | 0 | } | 274 | 192k | } |
_ZNK9prevectorILj35EhjiE8capacityEv Line | Count | Source | 268 | 77.0k | size_t capacity() const { | 269 | 77.0k | if (is_direct()) { | 270 | 77.0k | return N; | 271 | 77.0k | } else { | 272 | 0 | return _union.indirect_contents.capacity; | 273 | 0 | } | 274 | 77.0k | } |
|
275 | | |
276 | 9.72M | T& operator[](size_type pos) { |
277 | 9.72M | return *item_ptr(pos); |
278 | 9.72M | } _ZN9prevectorILj36EhjiEixEj Line | Count | Source | 276 | 8.93M | T& operator[](size_type pos) { | 277 | 8.93M | return *item_ptr(pos); | 278 | 8.93M | } |
_ZN9prevectorILj8EijiEixEj Line | Count | Source | 276 | 19.1k | T& operator[](size_type pos) { | 277 | 19.1k | return *item_ptr(pos); | 278 | 19.1k | } |
_ZN9prevectorILj33EhjiEixEj Line | Count | Source | 276 | 380k | T& operator[](size_type pos) { | 277 | 380k | return *item_ptr(pos); | 278 | 380k | } |
_ZN9prevectorILj16EhjiEixEj Line | Count | Source | 276 | 389k | T& operator[](size_type pos) { | 277 | 389k | return *item_ptr(pos); | 278 | 389k | } |
|
279 | | |
280 | 638M | const T& operator[](size_type pos) const { |
281 | 638M | return *item_ptr(pos); |
282 | 638M | } _ZNK9prevectorILj16EhjiEixEj Line | Count | Source | 280 | 497M | const T& operator[](size_type pos) const { | 281 | 497M | return *item_ptr(pos); | 282 | 497M | } |
_ZNK9prevectorILj36EhjiEixEj Line | Count | Source | 280 | 138M | const T& operator[](size_type pos) const { | 281 | 138M | return *item_ptr(pos); | 282 | 138M | } |
_ZNK9prevectorILj8EijiEixEj Line | Count | Source | 280 | 1.99M | const T& operator[](size_type pos) const { | 281 | 1.99M | return *item_ptr(pos); | 282 | 1.99M | } |
|
283 | | |
284 | 511M | void resize(size_type new_size) { |
285 | 511M | size_type cur_size = size(); |
286 | 511M | if (cur_size == new_size) { |
287 | 487M | return; |
288 | 487M | } |
289 | 23.3M | if (cur_size > new_size) { |
290 | 11.3M | erase(item_ptr(new_size), end()); |
291 | 11.3M | return; |
292 | 11.3M | } |
293 | 12.0M | if (new_size > capacity()) { |
294 | 7.63M | change_capacity(new_size); |
295 | 7.63M | } |
296 | 12.0M | ptrdiff_t increase = new_size - cur_size; |
297 | 12.0M | fill(item_ptr(cur_size), increase); |
298 | 12.0M | _size += increase; |
299 | 12.0M | } _ZN9prevectorILj36EhjiE6resizeEj Line | Count | Source | 284 | 483M | void resize(size_type new_size) { | 285 | 483M | size_type cur_size = size(); | 286 | 483M | if (cur_size == new_size) { | 287 | 478M | return; | 288 | 478M | } | 289 | 4.99M | if (cur_size > new_size) { | 290 | 410k | erase(item_ptr(new_size), end()); | 291 | 410k | return; | 292 | 410k | } | 293 | 4.58M | if (new_size > capacity()) { | 294 | 333k | change_capacity(new_size); | 295 | 333k | } | 296 | 4.58M | ptrdiff_t increase = new_size - cur_size; | 297 | 4.58M | fill(item_ptr(cur_size), increase); | 298 | 4.58M | _size += increase; | 299 | 4.58M | } |
_ZN9prevectorILj16EhjiE6resizeEj Line | Count | Source | 284 | 27.4M | void resize(size_type new_size) { | 285 | 27.4M | size_type cur_size = size(); | 286 | 27.4M | if (cur_size == new_size) { | 287 | 9.27M | return; | 288 | 9.27M | } | 289 | 18.1M | if (cur_size > new_size) { | 290 | 10.8M | erase(item_ptr(new_size), end()); | 291 | 10.8M | return; | 292 | 10.8M | } | 293 | 7.30M | if (new_size > capacity()) { | 294 | 7.30M | change_capacity(new_size); | 295 | 7.30M | } | 296 | 7.30M | ptrdiff_t increase = new_size - cur_size; | 297 | 7.30M | fill(item_ptr(cur_size), increase); | 298 | 7.30M | _size += increase; | 299 | 7.30M | } |
_ZN9prevectorILj8EijiE6resizeEj Line | Count | Source | 284 | 38.1k | void resize(size_type new_size) { | 285 | 38.1k | size_type cur_size = size(); | 286 | 38.1k | if (cur_size == new_size) { | 287 | 17.7k | return; | 288 | 17.7k | } | 289 | 20.3k | if (cur_size > new_size) { | 290 | 16.2k | erase(item_ptr(new_size), end()); | 291 | 16.2k | return; | 292 | 16.2k | } | 293 | 4.17k | if (new_size > capacity()) { | 294 | 385 | change_capacity(new_size); | 295 | 385 | } | 296 | 4.17k | ptrdiff_t increase = new_size - cur_size; | 297 | 4.17k | fill(item_ptr(cur_size), increase); | 298 | 4.17k | _size += increase; | 299 | 4.17k | } |
_ZN9prevectorILj33EhjiE6resizeEj Line | Count | Source | 284 | 192k | void resize(size_type new_size) { | 285 | 192k | size_type cur_size = size(); | 286 | 192k | if (cur_size == new_size) { | 287 | 2.09k | return; | 288 | 2.09k | } | 289 | 190k | if (cur_size > new_size) { | 290 | 0 | erase(item_ptr(new_size), end()); | 291 | 0 | return; | 292 | 0 | } | 293 | 190k | if (new_size > capacity()) { | 294 | 0 | change_capacity(new_size); | 295 | 0 | } | 296 | 190k | ptrdiff_t increase = new_size - cur_size; | 297 | 190k | fill(item_ptr(cur_size), increase); | 298 | 190k | _size += increase; | 299 | 190k | } |
|
300 | | |
301 | 4.10k | void reserve(size_type new_capacity) { |
302 | 4.10k | if (new_capacity > capacity()) { |
303 | 1.90k | change_capacity(new_capacity); |
304 | 1.90k | } |
305 | 4.10k | } _ZN9prevectorILj36EhjiE7reserveEj Line | Count | Source | 301 | 215 | void reserve(size_type new_capacity) { | 302 | 215 | if (new_capacity > capacity()) { | 303 | 91 | change_capacity(new_capacity); | 304 | 91 | } | 305 | 215 | } |
_ZN9prevectorILj8EijiE7reserveEj Line | Count | Source | 301 | 3.89k | void reserve(size_type new_capacity) { | 302 | 3.89k | if (new_capacity > capacity()) { | 303 | 1.81k | change_capacity(new_capacity); | 304 | 1.81k | } | 305 | 3.89k | } |
|
306 | | |
307 | 39.1M | void shrink_to_fit() { |
308 | 39.1M | change_capacity(size()); |
309 | 39.1M | } _ZN9prevectorILj36EhjiE13shrink_to_fitEv Line | Count | Source | 307 | 39.1M | void shrink_to_fit() { | 308 | 39.1M | change_capacity(size()); | 309 | 39.1M | } |
_ZN9prevectorILj8EijiE13shrink_to_fitEv Line | Count | Source | 307 | 6.08k | void shrink_to_fit() { | 308 | 6.08k | change_capacity(size()); | 309 | 6.08k | } |
|
310 | | |
311 | 484M | void clear() { |
312 | 484M | resize(0); |
313 | 484M | } _ZN9prevectorILj36EhjiE5clearEv Line | Count | Source | 311 | 476M | void clear() { | 312 | 476M | resize(0); | 313 | 476M | } |
_ZN9prevectorILj16EhjiE5clearEv Line | Count | Source | 311 | 7.63M | void clear() { | 312 | 7.63M | resize(0); | 313 | 7.63M | } |
_ZN9prevectorILj8EijiE5clearEv Line | Count | Source | 311 | 29.8k | void clear() { | 312 | 29.8k | resize(0); | 313 | 29.8k | } |
_ZN9prevectorILj33EhjiE5clearEv Line | Count | Source | 311 | 2.09k | void clear() { | 312 | 2.09k | resize(0); | 313 | 2.09k | } |
|
314 | | |
315 | 31.5M | iterator insert(iterator pos, const T& value) { |
316 | 31.5M | size_type p = pos - begin(); |
317 | 31.5M | size_type new_size = size() + 1; |
318 | 31.5M | if (capacity() < new_size) { |
319 | 64.6k | change_capacity(new_size + (new_size >> 1)); |
320 | 64.6k | } |
321 | 31.5M | T* ptr = item_ptr(p); |
322 | 31.5M | T* dst = ptr + 1; |
323 | 31.5M | memmove(dst, ptr, (size() - p) * sizeof(T)); |
324 | 31.5M | _size++; |
325 | 31.5M | new(static_cast<void*>(ptr)) T(value); |
326 | 31.5M | return iterator(ptr); |
327 | 31.5M | } _ZN9prevectorILj36EhjiE6insertENS0_8iteratorERKh Line | Count | Source | 315 | 31.5M | iterator insert(iterator pos, const T& value) { | 316 | 31.5M | size_type p = pos - begin(); | 317 | 31.5M | size_type new_size = size() + 1; | 318 | 31.5M | if (capacity() < new_size) { | 319 | 63.8k | change_capacity(new_size + (new_size >> 1)); | 320 | 63.8k | } | 321 | 31.5M | T* ptr = item_ptr(p); | 322 | 31.5M | T* dst = ptr + 1; | 323 | 31.5M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 324 | 31.5M | _size++; | 325 | 31.5M | new(static_cast<void*>(ptr)) T(value); | 326 | 31.5M | return iterator(ptr); | 327 | 31.5M | } |
_ZN9prevectorILj8EijiE6insertENS0_8iteratorERKi Line | Count | Source | 315 | 12.1k | iterator insert(iterator pos, const T& value) { | 316 | 12.1k | size_type p = pos - begin(); | 317 | 12.1k | size_type new_size = size() + 1; | 318 | 12.1k | if (capacity() < new_size) { | 319 | 807 | change_capacity(new_size + (new_size >> 1)); | 320 | 807 | } | 321 | 12.1k | T* ptr = item_ptr(p); | 322 | 12.1k | T* dst = ptr + 1; | 323 | 12.1k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 324 | 12.1k | _size++; | 325 | 12.1k | new(static_cast<void*>(ptr)) T(value); | 326 | 12.1k | return iterator(ptr); | 327 | 12.1k | } |
|
328 | | |
329 | 7.37k | void insert(iterator pos, size_type count, const T& value) { |
330 | 7.37k | size_type p = pos - begin(); |
331 | 7.37k | size_type new_size = size() + count; |
332 | 7.37k | if (capacity() < new_size) { |
333 | 587 | change_capacity(new_size + (new_size >> 1)); |
334 | 587 | } |
335 | 7.37k | T* ptr = item_ptr(p); |
336 | 7.37k | T* dst = ptr + count; |
337 | 7.37k | memmove(dst, ptr, (size() - p) * sizeof(T)); |
338 | 7.37k | _size += count; |
339 | 7.37k | fill(item_ptr(p), count, value); |
340 | 7.37k | } _ZN9prevectorILj8EijiE6insertENS0_8iteratorEjRKi Line | Count | Source | 329 | 7.37k | void insert(iterator pos, size_type count, const T& value) { | 330 | 7.37k | size_type p = pos - begin(); | 331 | 7.37k | size_type new_size = size() + count; | 332 | 7.37k | if (capacity() < new_size) { | 333 | 587 | change_capacity(new_size + (new_size >> 1)); | 334 | 587 | } | 335 | 7.37k | T* ptr = item_ptr(p); | 336 | 7.37k | T* dst = ptr + count; | 337 | 7.37k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 338 | 7.37k | _size += count; | 339 | 7.37k | fill(item_ptr(p), count, value); | 340 | 7.37k | } |
Unexecuted instantiation: _ZN9prevectorILj36EhjiE6insertENS0_8iteratorEjRKh |
341 | | |
342 | | template <std::input_iterator InputIterator> |
343 | 43.5M | void insert(iterator pos, InputIterator first, InputIterator last) { |
344 | 43.5M | size_type p = pos - begin(); |
345 | 43.5M | difference_type count = last - first; |
346 | 43.5M | size_type new_size = size() + count; |
347 | 43.5M | if (capacity() < new_size) { |
348 | 1.28M | change_capacity(new_size + (new_size >> 1)); |
349 | 1.28M | } |
350 | 43.5M | T* ptr = item_ptr(p); |
351 | 43.5M | T* dst = ptr + count; |
352 | 43.5M | memmove(dst, ptr, (size() - p) * sizeof(T)); |
353 | 43.5M | _size += count; |
354 | 43.5M | fill(ptr, first, last); |
355 | 43.5M | } _ZN9prevectorILj36EhjiE6insertITkSt14input_iteratorPKhEEvNS0_8iteratorET_S5_ Line | Count | Source | 343 | 19.3k | void insert(iterator pos, InputIterator first, InputIterator last) { | 344 | 19.3k | size_type p = pos - begin(); | 345 | 19.3k | difference_type count = last - first; | 346 | 19.3k | size_type new_size = size() + count; | 347 | 19.3k | if (capacity() < new_size) { | 348 | 117 | change_capacity(new_size + (new_size >> 1)); | 349 | 117 | } | 350 | 19.3k | T* ptr = item_ptr(p); | 351 | 19.3k | T* dst = ptr + count; | 352 | 19.3k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 353 | 19.3k | _size += count; | 354 | 19.3k | fill(ptr, first, last); | 355 | 19.3k | } |
_ZN9prevectorILj36EhjiE6insertITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPKhSt4spanIS4_Lm18446744073709551615EEEEEEvNS0_8iteratorET_SA_ Line | Count | Source | 343 | 14.9M | void insert(iterator pos, InputIterator first, InputIterator last) { | 344 | 14.9M | size_type p = pos - begin(); | 345 | 14.9M | difference_type count = last - first; | 346 | 14.9M | size_type new_size = size() + count; | 347 | 14.9M | if (capacity() < new_size) { | 348 | 475k | change_capacity(new_size + (new_size >> 1)); | 349 | 475k | } | 350 | 14.9M | T* ptr = item_ptr(p); | 351 | 14.9M | T* dst = ptr + count; | 352 | 14.9M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 353 | 14.9M | _size += count; | 354 | 14.9M | fill(ptr, first, last); | 355 | 14.9M | } |
_ZN9prevectorILj36EhjiE6insertITkSt14input_iteratorNS0_8iteratorEEEvS2_T_S3_ Line | Count | Source | 343 | 1.06M | void insert(iterator pos, InputIterator first, InputIterator last) { | 344 | 1.06M | size_type p = pos - begin(); | 345 | 1.06M | difference_type count = last - first; | 346 | 1.06M | size_type new_size = size() + count; | 347 | 1.06M | if (capacity() < new_size) { | 348 | 447k | change_capacity(new_size + (new_size >> 1)); | 349 | 447k | } | 350 | 1.06M | T* ptr = item_ptr(p); | 351 | 1.06M | T* dst = ptr + count; | 352 | 1.06M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 353 | 1.06M | _size += count; | 354 | 1.06M | fill(ptr, first, last); | 355 | 1.06M | } |
_ZN9prevectorILj8EijiE6insertITkSt14input_iteratorPiEEvNS0_8iteratorET_S4_ Line | Count | Source | 343 | 5.19k | void insert(iterator pos, InputIterator first, InputIterator last) { | 344 | 5.19k | size_type p = pos - begin(); | 345 | 5.19k | difference_type count = last - first; | 346 | 5.19k | size_type new_size = size() + count; | 347 | 5.19k | if (capacity() < new_size) { | 348 | 462 | change_capacity(new_size + (new_size >> 1)); | 349 | 462 | } | 350 | 5.19k | T* ptr = item_ptr(p); | 351 | 5.19k | T* dst = ptr + count; | 352 | 5.19k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 353 | 5.19k | _size += count; | 354 | 5.19k | fill(ptr, first, last); | 355 | 5.19k | } |
_ZN9prevectorILj36EhjiE6insertITkSt14input_iteratorN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEEEvNS0_8iteratorET_SA_ Line | Count | Source | 343 | 2.97M | void insert(iterator pos, InputIterator first, InputIterator last) { | 344 | 2.97M | size_type p = pos - begin(); | 345 | 2.97M | difference_type count = last - first; | 346 | 2.97M | size_type new_size = size() + count; | 347 | 2.97M | if (capacity() < new_size) { | 348 | 59.5k | change_capacity(new_size + (new_size >> 1)); | 349 | 59.5k | } | 350 | 2.97M | T* ptr = item_ptr(p); | 351 | 2.97M | T* dst = ptr + count; | 352 | 2.97M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 353 | 2.97M | _size += count; | 354 | 2.97M | fill(ptr, first, last); | 355 | 2.97M | } |
_ZN9prevectorILj35EhjiE6insertITkSt14input_iteratorPhEEvNS0_8iteratorET_S4_ Line | Count | Source | 343 | 38.5k | void insert(iterator pos, InputIterator first, InputIterator last) { | 344 | 38.5k | size_type p = pos - begin(); | 345 | 38.5k | difference_type count = last - first; | 346 | 38.5k | size_type new_size = size() + count; | 347 | 38.5k | if (capacity() < new_size) { | 348 | 0 | change_capacity(new_size + (new_size >> 1)); | 349 | 0 | } | 350 | 38.5k | T* ptr = item_ptr(p); | 351 | 38.5k | T* dst = ptr + count; | 352 | 38.5k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 353 | 38.5k | _size += count; | 354 | 38.5k | fill(ptr, first, last); | 355 | 38.5k | } |
_ZN9prevectorILj35EhjiE6insertITkSt14input_iteratorPKhEEvNS0_8iteratorET_S5_ Line | Count | Source | 343 | 38.5k | void insert(iterator pos, InputIterator first, InputIterator last) { | 344 | 38.5k | size_type p = pos - begin(); | 345 | 38.5k | difference_type count = last - first; | 346 | 38.5k | size_type new_size = size() + count; | 347 | 38.5k | if (capacity() < new_size) { | 348 | 0 | change_capacity(new_size + (new_size >> 1)); | 349 | 0 | } | 350 | 38.5k | T* ptr = item_ptr(p); | 351 | 38.5k | T* dst = ptr + count; | 352 | 38.5k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 353 | 38.5k | _size += count; | 354 | 38.5k | fill(ptr, first, last); | 355 | 38.5k | } |
_ZN9prevectorILj36EhjiE6insertITkSt14input_iteratorNS0_14const_iteratorEEEvNS0_8iteratorET_S4_ Line | Count | Source | 343 | 24.4M | void insert(iterator pos, InputIterator first, InputIterator last) { | 344 | 24.4M | size_type p = pos - begin(); | 345 | 24.4M | difference_type count = last - first; | 346 | 24.4M | size_type new_size = size() + count; | 347 | 24.4M | if (capacity() < new_size) { | 348 | 305k | change_capacity(new_size + (new_size >> 1)); | 349 | 305k | } | 350 | 24.4M | T* ptr = item_ptr(p); | 351 | 24.4M | T* dst = ptr + count; | 352 | 24.4M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 353 | 24.4M | _size += count; | 354 | 24.4M | fill(ptr, first, last); | 355 | 24.4M | } |
|
356 | | |
357 | 5.95M | inline void resize_uninitialized(size_type new_size) { |
358 | | // resize_uninitialized changes the size of the prevector but does not initialize it. |
359 | | // If size < new_size, the added elements must be initialized explicitly. |
360 | 5.95M | if (capacity() < new_size) { |
361 | 1.54M | change_capacity(new_size); |
362 | 1.54M | _size += new_size - size(); |
363 | 1.54M | return; |
364 | 1.54M | } |
365 | 4.41M | if (new_size < size()) { |
366 | 1.74k | erase(item_ptr(new_size), end()); |
367 | 4.41M | } else { |
368 | 4.41M | _size += new_size - size(); |
369 | 4.41M | } |
370 | 4.41M | } _ZN9prevectorILj36EhjiE20resize_uninitializedEj Line | Count | Source | 357 | 5.95M | inline void resize_uninitialized(size_type new_size) { | 358 | | // resize_uninitialized changes the size of the prevector but does not initialize it. | 359 | | // If size < new_size, the added elements must be initialized explicitly. | 360 | 5.95M | if (capacity() < new_size) { | 361 | 1.54M | change_capacity(new_size); | 362 | 1.54M | _size += new_size - size(); | 363 | 1.54M | return; | 364 | 1.54M | } | 365 | 4.41M | if (new_size < size()) { | 366 | 0 | erase(item_ptr(new_size), end()); | 367 | 4.41M | } else { | 368 | 4.41M | _size += new_size - size(); | 369 | 4.41M | } | 370 | 4.41M | } |
_ZN9prevectorILj8EijiE20resize_uninitializedEj Line | Count | Source | 357 | 5.21k | inline void resize_uninitialized(size_type new_size) { | 358 | | // resize_uninitialized changes the size of the prevector but does not initialize it. | 359 | | // If size < new_size, the added elements must be initialized explicitly. | 360 | 5.21k | if (capacity() < new_size) { | 361 | 880 | change_capacity(new_size); | 362 | 880 | _size += new_size - size(); | 363 | 880 | return; | 364 | 880 | } | 365 | 4.33k | if (new_size < size()) { | 366 | 1.74k | erase(item_ptr(new_size), end()); | 367 | 2.59k | } else { | 368 | 2.59k | _size += new_size - size(); | 369 | 2.59k | } | 370 | 4.33k | } |
|
371 | | |
372 | 2.61k | iterator erase(iterator pos) { |
373 | 2.61k | return erase(pos, pos + 1); |
374 | 2.61k | } _ZN9prevectorILj8EijiE5eraseENS0_8iteratorE Line | Count | Source | 372 | 2.59k | iterator erase(iterator pos) { | 373 | 2.59k | return erase(pos, pos + 1); | 374 | 2.59k | } |
_ZN9prevectorILj33EhjiE5eraseENS0_8iteratorE Line | Count | Source | 372 | 14 | iterator erase(iterator pos) { | 373 | 14 | return erase(pos, pos + 1); | 374 | 14 | } |
|
375 | | |
376 | 11.3M | iterator erase(iterator first, iterator last) { |
377 | | // Erase is not allowed to the change the object's capacity. That means |
378 | | // that when starting with an indirectly allocated prevector with |
379 | | // size and capacity > N, the result may be a still indirectly allocated |
380 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is |
381 | | // necessary to switch to the (more efficient) directly allocated |
382 | | // representation (with capacity N and size <= N). |
383 | 11.3M | iterator p = first; |
384 | 11.3M | char* endp = (char*)&(*end()); |
385 | 11.3M | _size -= last - p; |
386 | 11.3M | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); |
387 | 11.3M | return first; |
388 | 11.3M | } _ZN9prevectorILj36EhjiE5eraseENS0_8iteratorES1_ Line | Count | Source | 376 | 410k | iterator erase(iterator first, iterator last) { | 377 | | // Erase is not allowed to the change the object's capacity. That means | 378 | | // that when starting with an indirectly allocated prevector with | 379 | | // size and capacity > N, the result may be a still indirectly allocated | 380 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 381 | | // necessary to switch to the (more efficient) directly allocated | 382 | | // representation (with capacity N and size <= N). | 383 | 410k | iterator p = first; | 384 | 410k | char* endp = (char*)&(*end()); | 385 | 410k | _size -= last - p; | 386 | 410k | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 387 | 410k | return first; | 388 | 410k | } |
_ZN9prevectorILj16EhjiE5eraseENS0_8iteratorES1_ Line | Count | Source | 376 | 10.8M | iterator erase(iterator first, iterator last) { | 377 | | // Erase is not allowed to the change the object's capacity. That means | 378 | | // that when starting with an indirectly allocated prevector with | 379 | | // size and capacity > N, the result may be a still indirectly allocated | 380 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 381 | | // necessary to switch to the (more efficient) directly allocated | 382 | | // representation (with capacity N and size <= N). | 383 | 10.8M | iterator p = first; | 384 | 10.8M | char* endp = (char*)&(*end()); | 385 | 10.8M | _size -= last - p; | 386 | 10.8M | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 387 | 10.8M | return first; | 388 | 10.8M | } |
_ZN9prevectorILj8EijiE5eraseENS0_8iteratorES1_ Line | Count | Source | 376 | 29.7k | iterator erase(iterator first, iterator last) { | 377 | | // Erase is not allowed to the change the object's capacity. That means | 378 | | // that when starting with an indirectly allocated prevector with | 379 | | // size and capacity > N, the result may be a still indirectly allocated | 380 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 381 | | // necessary to switch to the (more efficient) directly allocated | 382 | | // representation (with capacity N and size <= N). | 383 | 29.7k | iterator p = first; | 384 | 29.7k | char* endp = (char*)&(*end()); | 385 | 29.7k | _size -= last - p; | 386 | 29.7k | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 387 | 29.7k | return first; | 388 | 29.7k | } |
_ZN9prevectorILj33EhjiE5eraseENS0_8iteratorES1_ Line | Count | Source | 376 | 14 | iterator erase(iterator first, iterator last) { | 377 | | // Erase is not allowed to the change the object's capacity. That means | 378 | | // that when starting with an indirectly allocated prevector with | 379 | | // size and capacity > N, the result may be a still indirectly allocated | 380 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 381 | | // necessary to switch to the (more efficient) directly allocated | 382 | | // representation (with capacity N and size <= N). | 383 | 14 | iterator p = first; | 384 | 14 | char* endp = (char*)&(*end()); | 385 | 14 | _size -= last - p; | 386 | 14 | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 387 | 14 | return first; | 388 | 14 | } |
|
389 | | |
390 | | template<typename... Args> |
391 | 788k | void emplace_back(Args&&... args) { |
392 | 788k | size_type new_size = size() + 1; |
393 | 788k | if (capacity() < new_size) { |
394 | 8.81k | change_capacity(new_size + (new_size >> 1)); |
395 | 8.81k | } |
396 | 788k | new(item_ptr(size())) T(std::forward<Args>(args)...); |
397 | 788k | _size++; |
398 | 788k | } _ZN9prevectorILj36EhjiE12emplace_backIJRKhEEEvDpOT_ Line | Count | Source | 391 | 785k | void emplace_back(Args&&... args) { | 392 | 785k | size_type new_size = size() + 1; | 393 | 785k | if (capacity() < new_size) { | 394 | 8.27k | change_capacity(new_size + (new_size >> 1)); | 395 | 8.27k | } | 396 | 785k | new(item_ptr(size())) T(std::forward<Args>(args)...); | 397 | 785k | _size++; | 398 | 785k | } |
_ZN9prevectorILj8EijiE12emplace_backIJRKiEEEvDpOT_ Line | Count | Source | 391 | 3.24k | void emplace_back(Args&&... args) { | 392 | 3.24k | size_type new_size = size() + 1; | 393 | 3.24k | if (capacity() < new_size) { | 394 | 542 | change_capacity(new_size + (new_size >> 1)); | 395 | 542 | } | 396 | 3.24k | new(item_ptr(size())) T(std::forward<Args>(args)...); | 397 | 3.24k | _size++; | 398 | 3.24k | } |
|
399 | | |
400 | 788k | void push_back(const T& value) { |
401 | 788k | emplace_back(value); |
402 | 788k | } _ZN9prevectorILj36EhjiE9push_backERKh Line | Count | Source | 400 | 785k | void push_back(const T& value) { | 401 | 785k | emplace_back(value); | 402 | 785k | } |
_ZN9prevectorILj8EijiE9push_backERKi Line | Count | Source | 400 | 3.24k | void push_back(const T& value) { | 401 | 3.24k | emplace_back(value); | 402 | 3.24k | } |
|
403 | | |
404 | 4.01k | void pop_back() { |
405 | 4.01k | erase(end() - 1, end()); |
406 | 4.01k | } |
407 | | |
408 | | T& front() { |
409 | | return *item_ptr(0); |
410 | | } |
411 | | |
412 | | const T& front() const { |
413 | | return *item_ptr(0); |
414 | | } |
415 | | |
416 | 11.3k | T& back() { |
417 | 11.3k | return *item_ptr(size() - 1); |
418 | 11.3k | } |
419 | | |
420 | 2.78M | const T& back() const { |
421 | 2.78M | return *item_ptr(size() - 1); |
422 | 2.78M | } |
423 | | |
424 | | void swap(prevector<N, T, Size, Diff>& other) noexcept |
425 | 5.48k | { |
426 | 5.48k | std::swap(_union, other._union); |
427 | 5.48k | std::swap(_size, other._size); |
428 | 5.48k | } |
429 | | |
430 | 2.26G | ~prevector() { |
431 | 2.26G | if (!is_direct()) { |
432 | 77.5M | free(_union.indirect_contents.indirect); |
433 | 77.5M | _union.indirect_contents.indirect = nullptr; |
434 | 77.5M | } |
435 | 2.26G | } _ZN9prevectorILj16EhjiED2Ev Line | Count | Source | 430 | 225M | ~prevector() { | 431 | 225M | if (!is_direct()) { | 432 | 71.3M | free(_union.indirect_contents.indirect); | 433 | 71.3M | _union.indirect_contents.indirect = nullptr; | 434 | 71.3M | } | 435 | 225M | } |
_ZN9prevectorILj36EhjiED2Ev Line | Count | Source | 430 | 2.03G | ~prevector() { | 431 | 2.03G | if (!is_direct()) { | 432 | 6.20M | free(_union.indirect_contents.indirect); | 433 | 6.20M | _union.indirect_contents.indirect = nullptr; | 434 | 6.20M | } | 435 | 2.03G | } |
_ZN9prevectorILj33EhjiED2Ev Line | Count | Source | 430 | 2.46M | ~prevector() { | 431 | 2.46M | if (!is_direct()) { | 432 | 509 | free(_union.indirect_contents.indirect); | 433 | 509 | _union.indirect_contents.indirect = nullptr; | 434 | 509 | } | 435 | 2.46M | } |
_ZN9prevectorILj8EijiED2Ev Line | Count | Source | 430 | 588 | ~prevector() { | 431 | 588 | if (!is_direct()) { | 432 | 263 | free(_union.indirect_contents.indirect); | 433 | 263 | _union.indirect_contents.indirect = nullptr; | 434 | 263 | } | 435 | 588 | } |
_ZN9prevectorILj35EhjiED2Ev Line | Count | Source | 430 | 38.5k | ~prevector() { | 431 | 38.5k | if (!is_direct()) { | 432 | 0 | free(_union.indirect_contents.indirect); | 433 | 0 | _union.indirect_contents.indirect = nullptr; | 434 | 0 | } | 435 | 38.5k | } |
|
436 | | |
437 | 32.0M | bool operator==(const prevector<N, T, Size, Diff>& other) const { |
438 | 32.0M | if (other.size() != size()) { |
439 | 649 | return false; |
440 | 649 | } |
441 | 32.0M | const_iterator b1 = begin(); |
442 | 32.0M | const_iterator b2 = other.begin(); |
443 | 32.0M | const_iterator e1 = end(); |
444 | 574M | while (b1 != e1) { |
445 | 550M | if ((*b1) != (*b2)) { |
446 | 8.07M | return false; |
447 | 8.07M | } |
448 | 542M | ++b1; |
449 | 542M | ++b2; |
450 | 542M | } |
451 | 23.9M | return true; |
452 | 32.0M | } _ZNK9prevectorILj36EhjiEeqERKS0_ Line | Count | Source | 437 | 763k | bool operator==(const prevector<N, T, Size, Diff>& other) const { | 438 | 763k | if (other.size() != size()) { | 439 | 649 | return false; | 440 | 649 | } | 441 | 762k | const_iterator b1 = begin(); | 442 | 762k | const_iterator b2 = other.begin(); | 443 | 762k | const_iterator e1 = end(); | 444 | 68.4M | while (b1 != e1) { | 445 | 67.7M | if ((*b1) != (*b2)) { | 446 | 61 | return false; | 447 | 61 | } | 448 | 67.7M | ++b1; | 449 | 67.7M | ++b2; | 450 | 67.7M | } | 451 | 762k | return true; | 452 | 762k | } |
_ZNK9prevectorILj8EijiEeqERKS0_ Line | Count | Source | 437 | 294 | bool operator==(const prevector<N, T, Size, Diff>& other) const { | 438 | 294 | if (other.size() != size()) { | 439 | 0 | return false; | 440 | 0 | } | 441 | 294 | const_iterator b1 = begin(); | 442 | 294 | const_iterator b2 = other.begin(); | 443 | 294 | const_iterator e1 = end(); | 444 | 995k | while (b1 != e1) { | 445 | 995k | if ((*b1) != (*b2)) { | 446 | 0 | return false; | 447 | 0 | } | 448 | 995k | ++b1; | 449 | 995k | ++b2; | 450 | 995k | } | 451 | 294 | return true; | 452 | 294 | } |
_ZNK9prevectorILj16EhjiEeqERKS0_ Line | Count | Source | 437 | 31.2M | bool operator==(const prevector<N, T, Size, Diff>& other) const { | 438 | 31.2M | if (other.size() != size()) { | 439 | 0 | return false; | 440 | 0 | } | 441 | 31.2M | const_iterator b1 = begin(); | 442 | 31.2M | const_iterator b2 = other.begin(); | 443 | 31.2M | const_iterator e1 = end(); | 444 | 505M | while (b1 != e1) { | 445 | 482M | if ((*b1) != (*b2)) { | 446 | 8.07M | return false; | 447 | 8.07M | } | 448 | 473M | ++b1; | 449 | 473M | ++b2; | 450 | 473M | } | 451 | 23.1M | return true; | 452 | 31.2M | } |
|
453 | | |
454 | 47.0k | bool operator!=(const prevector<N, T, Size, Diff>& other) const { |
455 | 47.0k | return !(*this == other); |
456 | 47.0k | } |
457 | | |
458 | 5.62M | bool operator<(const prevector<N, T, Size, Diff>& other) const { |
459 | 5.62M | if (size() < other.size()) { |
460 | 39.9k | return true; |
461 | 39.9k | } |
462 | 5.58M | if (size() > other.size()) { |
463 | 38.5k | return false; |
464 | 38.5k | } |
465 | 5.55M | const_iterator b1 = begin(); |
466 | 5.55M | const_iterator b2 = other.begin(); |
467 | 5.55M | const_iterator e1 = end(); |
468 | 42.9M | while (b1 != e1) { |
469 | 41.6M | if ((*b1) < (*b2)) { |
470 | 2.81M | return true; |
471 | 2.81M | } |
472 | 38.8M | if ((*b2) < (*b1)) { |
473 | 1.42M | return false; |
474 | 1.42M | } |
475 | 37.4M | ++b1; |
476 | 37.4M | ++b2; |
477 | 37.4M | } |
478 | 1.31M | return false; |
479 | 5.55M | } _ZNK9prevectorILj36EhjiEltERKS0_ Line | Count | Source | 458 | 1.67M | bool operator<(const prevector<N, T, Size, Diff>& other) const { | 459 | 1.67M | if (size() < other.size()) { | 460 | 39.9k | return true; | 461 | 39.9k | } | 462 | 1.63M | if (size() > other.size()) { | 463 | 38.5k | return false; | 464 | 38.5k | } | 465 | 1.60M | const_iterator b1 = begin(); | 466 | 1.60M | const_iterator b2 = other.begin(); | 467 | 1.60M | const_iterator e1 = end(); | 468 | 17.4M | while (b1 != e1) { | 469 | 17.2M | if ((*b1) < (*b2)) { | 470 | 826k | return true; | 471 | 826k | } | 472 | 16.4M | if ((*b2) < (*b1)) { | 473 | 558k | return false; | 474 | 558k | } | 475 | 15.8M | ++b1; | 476 | 15.8M | ++b2; | 477 | 15.8M | } | 478 | 215k | return false; | 479 | 1.60M | } |
_ZNK9prevectorILj16EhjiEltERKS0_ Line | Count | Source | 458 | 3.95M | bool operator<(const prevector<N, T, Size, Diff>& other) const { | 459 | 3.95M | if (size() < other.size()) { | 460 | 0 | return true; | 461 | 0 | } | 462 | 3.95M | if (size() > other.size()) { | 463 | 0 | return false; | 464 | 0 | } | 465 | 3.95M | const_iterator b1 = begin(); | 466 | 3.95M | const_iterator b2 = other.begin(); | 467 | 3.95M | const_iterator e1 = end(); | 468 | 25.5M | while (b1 != e1) { | 469 | 24.4M | if ((*b1) < (*b2)) { | 470 | 1.99M | return true; | 471 | 1.99M | } | 472 | 22.4M | if ((*b2) < (*b1)) { | 473 | 862k | return false; | 474 | 862k | } | 475 | 21.5M | ++b1; | 476 | 21.5M | ++b2; | 477 | 21.5M | } | 478 | 1.09M | return false; | 479 | 3.95M | } |
|
480 | | |
481 | 37.6M | size_t allocated_memory() const { |
482 | 37.6M | if (is_direct()) { |
483 | 35.7M | return 0; |
484 | 35.7M | } else { |
485 | 1.95M | return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity; |
486 | 1.95M | } |
487 | 37.6M | } |
488 | | |
489 | 27.1M | value_type* data() { |
490 | 27.1M | return item_ptr(0); |
491 | 27.1M | } _ZN9prevectorILj33EhjiE4dataEv Line | Count | Source | 489 | 483k | value_type* data() { | 490 | 483k | return item_ptr(0); | 491 | 483k | } |
_ZN9prevectorILj36EhjiE4dataEv Line | Count | Source | 489 | 6.82M | value_type* data() { | 490 | 6.82M | return item_ptr(0); | 491 | 6.82M | } |
_ZN9prevectorILj16EhjiE4dataEv Line | Count | Source | 489 | 19.8M | value_type* data() { | 490 | 19.8M | return item_ptr(0); | 491 | 19.8M | } |
_ZN9prevectorILj35EhjiE4dataEv Line | Count | Source | 489 | 38.5k | value_type* data() { | 490 | 38.5k | return item_ptr(0); | 491 | 38.5k | } |
|
492 | | |
493 | 1.74G | const value_type* data() const { |
494 | 1.74G | return item_ptr(0); |
495 | 1.74G | } _ZNK9prevectorILj36EhjiE4dataEv Line | Count | Source | 493 | 1.34G | const value_type* data() const { | 494 | 1.34G | return item_ptr(0); | 495 | 1.34G | } |
_ZNK9prevectorILj16EhjiE4dataEv Line | Count | Source | 493 | 397M | const value_type* data() const { | 494 | 397M | return item_ptr(0); | 495 | 397M | } |
_ZNK9prevectorILj33EhjiE4dataEv Line | Count | Source | 493 | 293k | const value_type* data() const { | 494 | 293k | return item_ptr(0); | 495 | 293k | } |
|
496 | | }; |
497 | | |
498 | | #endif // BITCOIN_PREVECTOR_H |