/tmp/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 <cstdint> |
11 | | #include <cstdlib> |
12 | | #include <cstring> |
13 | | #include <iterator> |
14 | | #include <new> |
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 | 82.6M | iterator(T* ptr_) : ptr(ptr_) {}prevector<36u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*) Line | Count | Source | 60 | 68.0M | iterator(T* ptr_) : ptr(ptr_) {} |
prevector<16u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*) Line | Count | Source | 60 | 487k | iterator(T* ptr_) : ptr(ptr_) {} |
prevector<8u, int, unsigned int, int>::iterator::iterator(int*) Line | Count | Source | 60 | 14.1M | iterator(T* ptr_) : ptr(ptr_) {} |
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*) prevector<35u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*) Line | Count | Source | 60 | 1.20k | iterator(T* ptr_) : ptr(ptr_) {} |
|
61 | 134M | T& operator*() const { return *ptr; }prevector<36u, unsigned char, unsigned int, int>::iterator::operator*() const Line | Count | Source | 61 | 122M | T& operator*() const { return *ptr; } |
prevector<16u, unsigned char, unsigned int, int>::iterator::operator*() const Line | Count | Source | 61 | 975k | T& operator*() const { return *ptr; } |
prevector<8u, int, unsigned int, int>::iterator::operator*() const Line | Count | Source | 61 | 11.1M | T& operator*() const { return *ptr; } |
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::iterator::operator*() const prevector<35u, unsigned char, unsigned int, int>::iterator::operator*() const Line | Count | Source | 61 | 1.20k | T& operator*() const { return *ptr; } |
|
62 | 36.0k | T* operator->() const { return ptr; }Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::iterator::operator->() const Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::iterator::operator->() const prevector<36u, unsigned char, unsigned int, int>::iterator::operator->() const Line | Count | Source | 62 | 36.0k | T* operator->() const { return ptr; } |
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::iterator::operator->() const |
63 | 2.01M | T& operator[](size_type pos) const { return ptr[pos]; } |
64 | 41.7M | iterator& operator++() { ptr++; return *this; }prevector<36u, unsigned char, unsigned int, int>::iterator::operator++() Line | Count | Source | 64 | 37.7M | iterator& operator++() { ptr++; return *this; } |
prevector<8u, int, unsigned int, int>::iterator::operator++() Line | Count | Source | 64 | 4.02M | iterator& operator++() { ptr++; return *this; } |
|
65 | 4.02M | 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 | 24.8M | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }operator-(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator) Line | Count | Source | 68 | 24.2M | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
operator-(prevector<16u, unsigned char, unsigned int, int>::iterator, prevector<16u, unsigned char, unsigned int, int>::iterator) Line | Count | Source | 68 | 162k | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
operator-(prevector<8u, int, unsigned int, int>::iterator, prevector<8u, int, unsigned int, int>::iterator) Line | Count | Source | 68 | 388k | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
Unexecuted instantiation: operator-(prevector<33u, unsigned char, unsigned int, int>::iterator, prevector<33u, unsigned char, unsigned int, int>::iterator) operator-(prevector<35u, unsigned char, unsigned int, int>::iterator, prevector<35u, unsigned char, unsigned int, int>::iterator) Line | Count | Source | 68 | 602 | difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } |
|
69 | 4.17M | 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 | 2.01M | iterator operator-(size_type n) const { return iterator(ptr - n); } |
73 | | iterator& operator-=(size_type n) { ptr -= n; return *this; } |
74 | 44.7M | bool operator==(iterator x) const { return ptr == x.ptr; }prevector<36u, unsigned char, unsigned int, int>::iterator::operator==(prevector<36u, unsigned char, unsigned int, int>::iterator) const Line | Count | Source | 74 | 37.8M | bool operator==(iterator x) const { return ptr == x.ptr; } |
prevector<8u, int, unsigned int, int>::iterator::operator==(prevector<8u, int, unsigned int, int>::iterator) const Line | Count | Source | 74 | 6.82M | bool operator==(iterator x) const { return ptr == x.ptr; } |
|
75 | 0 | auto operator<=>(iterator x) const { return ptr <=> x.ptr; }Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<16u, unsigned char, unsigned int, int>::iterator) const Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<33u, unsigned char, unsigned int, int>::iterator) const Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<36u, unsigned char, unsigned int, int>::iterator) const Unexecuted instantiation: prevector<8u, int, unsigned int, int>::iterator::operator<=>(prevector<8u, int, unsigned int, int>::iterator) const Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<35u, unsigned char, unsigned int, int>::iterator) const |
76 | | }; |
77 | | |
78 | | class const_iterator { |
79 | | const T* ptr{}; |
80 | | public: |
81 | | typedef Diff difference_type; |
82 | | typedef const T* pointer; |
83 | | typedef const T& reference; |
84 | | using element_type = const T; |
85 | | using iterator_category = std::contiguous_iterator_tag; |
86 | | const_iterator() = default; |
87 | 1.80G | const_iterator(const T* ptr_) : ptr(ptr_) {}prevector<16u, unsigned char, unsigned int, int>::const_iterator::const_iterator(unsigned char const*) Line | Count | Source | 87 | 7.71M | const_iterator(const T* ptr_) : ptr(ptr_) {} |
prevector<36u, unsigned char, unsigned int, int>::const_iterator::const_iterator(unsigned char const*) Line | Count | Source | 87 | 1.79G | const_iterator(const T* ptr_) : ptr(ptr_) {} |
prevector<8u, int, unsigned int, int>::const_iterator::const_iterator(int const*) Line | Count | Source | 87 | 3.73M | const_iterator(const T* ptr_) : ptr(ptr_) {} |
|
88 | 760k | const_iterator(iterator x) : ptr(&(*x)) {} |
89 | 18.3G | const T& operator*() const { return *ptr; }prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator*() const Line | Count | Source | 89 | 18.3G | const T& operator*() const { return *ptr; } |
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator*() const Line | Count | Source | 89 | 12.3M | const T& operator*() const { return *ptr; } |
prevector<8u, int, unsigned int, int>::const_iterator::operator*() const Line | Count | Source | 89 | 16.2M | const T& operator*() const { return *ptr; } |
|
90 | 3.98M | const T* operator->() const { return ptr; }prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator->() const Line | Count | Source | 90 | 587 | const T* operator->() const { return ptr; } |
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator->() const Line | Count | Source | 90 | 3.98M | const T* operator->() const { return ptr; } |
|
91 | 186k | const T& operator[](size_type pos) const { return ptr[pos]; } |
92 | 16.3G | const_iterator& operator++() { ptr++; return *this; }prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator++() Line | Count | Source | 92 | 16.3G | const_iterator& operator++() { ptr++; return *this; } |
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator++() Line | Count | Source | 92 | 6.74M | const_iterator& operator++() { ptr++; return *this; } |
prevector<8u, int, unsigned int, int>::const_iterator::operator++() Line | Count | Source | 92 | 12.1M | const_iterator& operator++() { ptr++; return *this; } |
|
93 | 4.02M | const_iterator& operator--() { ptr--; return *this; }prevector<8u, int, unsigned int, int>::const_iterator::operator--() Line | Count | Source | 93 | 4.02M | const_iterator& operator--() { ptr--; return *this; } |
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator--() |
94 | 792M | const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; } |
95 | | const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; } |
96 | 850M | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }operator-(prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator) Line | Count | Source | 96 | 849M | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } |
operator-(prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator) Line | Count | Source | 96 | 492k | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } |
operator-(prevector<8u, int, unsigned int, int>::const_iterator, prevector<8u, int, unsigned int, int>::const_iterator) Line | Count | Source | 96 | 1.07M | difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } |
|
97 | 7.12M | const_iterator operator+(size_type n) const { return const_iterator(ptr + n); } |
98 | | const_iterator friend operator+(size_type n, const_iterator x) { return x + n; } |
99 | 11.2M | const_iterator& operator+=(size_type n) { ptr += n; return *this; } |
100 | 590 | const_iterator operator-(size_type n) const { return const_iterator(ptr - n); } |
101 | | const_iterator& operator-=(size_type n) { ptr -= n; return *this; } |
102 | 15.4G | bool operator==(const_iterator x) const { return ptr == x.ptr; }prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator==(prevector<36u, unsigned char, unsigned int, int>::const_iterator) const Line | Count | Source | 102 | 15.4G | bool operator==(const_iterator x) const { return ptr == x.ptr; } |
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator==(prevector<16u, unsigned char, unsigned int, int>::const_iterator) const Line | Count | Source | 102 | 7.59M | bool operator==(const_iterator x) const { return ptr == x.ptr; } |
prevector<8u, int, unsigned int, int>::const_iterator::operator==(prevector<8u, int, unsigned int, int>::const_iterator) const Line | Count | Source | 102 | 11.4M | bool operator==(const_iterator x) const { return ptr == x.ptr; } |
|
103 | 1.58G | auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; }Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<16u, unsigned char, unsigned int, int>::const_iterator) const prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<36u, unsigned char, unsigned int, int>::const_iterator) const Line | Count | Source | 103 | 1.58G | auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; } |
Unexecuted instantiation: prevector<8u, int, unsigned int, int>::const_iterator::operator<=>(prevector<8u, int, unsigned int, int>::const_iterator) const |
104 | | }; |
105 | | |
106 | | private: |
107 | | #pragma pack(push, 1) |
108 | | union direct_or_indirect { |
109 | | char direct[sizeof(T) * N]; |
110 | | struct { |
111 | | char* indirect; |
112 | | size_type capacity; |
113 | | } indirect_contents; |
114 | | }; |
115 | | #pragma pack(pop) |
116 | | alignas(char*) direct_or_indirect _union = {}; |
117 | | size_type _size = 0; |
118 | | |
119 | | static_assert(alignof(char*) % alignof(size_type) == 0 && sizeof(char*) % alignof(size_type) == 0, "size_type cannot have more restrictive alignment requirement than pointer"); |
120 | | static_assert(alignof(char*) % alignof(T) == 0, "value_type T cannot have more restrictive alignment requirement than pointer"); |
121 | | |
122 | 108M | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }prevector<36u, unsigned char, unsigned int, int>::direct_ptr(int) Line | Count | Source | 122 | 103M | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
prevector<16u, unsigned char, unsigned int, int>::direct_ptr(int) Line | Count | Source | 122 | 2.20M | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
prevector<33u, unsigned char, unsigned int, int>::direct_ptr(int) Line | Count | Source | 122 | 787k | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
prevector<8u, int, unsigned int, int>::direct_ptr(int) Line | Count | Source | 122 | 2.92M | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
prevector<4u, Network, unsigned int, int>::direct_ptr(int) Line | Count | Source | 122 | 984 | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
prevector<35u, unsigned char, unsigned int, int>::direct_ptr(int) Line | Count | Source | 122 | 2.40k | T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } |
|
123 | 281M | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }prevector<36u, unsigned char, unsigned int, int>::direct_ptr(int) const Line | Count | Source | 123 | 262M | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
prevector<16u, unsigned char, unsigned int, int>::direct_ptr(int) const Line | Count | Source | 123 | 17.5M | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
prevector<8u, int, unsigned int, int>::direct_ptr(int) const Line | Count | Source | 123 | 1.61M | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
prevector<33u, unsigned char, unsigned int, int>::direct_ptr(int) const Line | Count | Source | 123 | 135k | const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } |
|
124 | 34.6M | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int) Line | Count | Source | 124 | 20.6M | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } |
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int) Line | Count | Source | 124 | 2.83k | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } |
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::indirect_ptr(int) prevector<8u, int, unsigned int, int>::indirect_ptr(int) Line | Count | Source | 124 | 13.9M | T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } |
Unexecuted instantiation: prevector<4u, Network, unsigned int, int>::indirect_ptr(int) Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::indirect_ptr(int) |
125 | 1.56G | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int) const Line | Count | Source | 125 | 1.56G | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } |
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int) const Line | Count | Source | 125 | 7.50k | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } |
prevector<8u, int, unsigned int, int>::indirect_ptr(int) const Line | Count | Source | 125 | 2.12M | const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } |
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::indirect_ptr(int) const |
126 | 4.52G | bool is_direct() const { return _size <= N; }prevector<36u, unsigned char, unsigned int, int>::is_direct() const Line | Count | Source | 126 | 4.45G | bool is_direct() const { return _size <= N; } |
prevector<16u, unsigned char, unsigned int, int>::is_direct() const Line | Count | Source | 126 | 32.9M | bool is_direct() const { return _size <= N; } |
prevector<33u, unsigned char, unsigned int, int>::is_direct() const Line | Count | Source | 126 | 2.22M | bool is_direct() const { return _size <= N; } |
prevector<8u, int, unsigned int, int>::is_direct() const Line | Count | Source | 126 | 28.6M | bool is_direct() const { return _size <= N; } |
prevector<4u, Network, unsigned int, int>::is_direct() const Line | Count | Source | 126 | 3.93k | bool is_direct() const { return _size <= N; } |
prevector<35u, unsigned char, unsigned int, int>::is_direct() const Line | Count | Source | 126 | 5.71k | bool is_direct() const { return _size <= N; } |
|
127 | | |
128 | 118M | void change_capacity(size_type new_capacity) { |
129 | 118M | if (new_capacity <= N) { |
130 | 116M | if (!is_direct()) { |
131 | 45.2k | T* indirect = indirect_ptr(0); |
132 | 45.2k | T* src = indirect; |
133 | 45.2k | T* dst = direct_ptr(0); |
134 | 45.2k | memcpy(dst, src, size() * sizeof(T)); |
135 | 45.2k | free(indirect); |
136 | 45.2k | _size -= N + 1; |
137 | 45.2k | } |
138 | 116M | } else { |
139 | 2.47M | if (!is_direct()) { |
140 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert |
141 | | success. These should instead use an allocator or new/delete so that handlers |
142 | | are called as necessary, but performance would be slightly degraded by doing so. */ |
143 | 82.9k | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); |
144 | 82.9k | assert(_union.indirect_contents.indirect); |
145 | 82.9k | _union.indirect_contents.capacity = new_capacity; |
146 | 2.38M | } else { |
147 | 2.38M | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); |
148 | 2.38M | assert(new_indirect); |
149 | 2.38M | T* src = direct_ptr(0); |
150 | 2.38M | T* dst = reinterpret_cast<T*>(new_indirect); |
151 | 2.38M | memcpy(dst, src, size() * sizeof(T)); |
152 | 2.38M | _union.indirect_contents.indirect = new_indirect; |
153 | 2.38M | _union.indirect_contents.capacity = new_capacity; |
154 | 2.38M | _size += N + 1; |
155 | 2.38M | } |
156 | 2.47M | } |
157 | 118M | } prevector<36u, unsigned char, unsigned int, int>::change_capacity(unsigned int) Line | Count | Source | 128 | 116M | void change_capacity(size_type new_capacity) { | 129 | 116M | if (new_capacity <= N) { | 130 | 114M | if (!is_direct()) { | 131 | 44.6k | T* indirect = indirect_ptr(0); | 132 | 44.6k | T* src = indirect; | 133 | 44.6k | T* dst = direct_ptr(0); | 134 | 44.6k | memcpy(dst, src, size() * sizeof(T)); | 135 | 44.6k | free(indirect); | 136 | 44.6k | _size -= N + 1; | 137 | 44.6k | } | 138 | 114M | } else { | 139 | 2.27M | if (!is_direct()) { | 140 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 141 | | success. These should instead use an allocator or new/delete so that handlers | 142 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 143 | 78.9k | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 144 | 78.9k | assert(_union.indirect_contents.indirect); | 145 | 78.9k | _union.indirect_contents.capacity = new_capacity; | 146 | 2.19M | } else { | 147 | 2.19M | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 148 | 2.19M | assert(new_indirect); | 149 | 2.19M | T* src = direct_ptr(0); | 150 | 2.19M | T* dst = reinterpret_cast<T*>(new_indirect); | 151 | 2.19M | memcpy(dst, src, size() * sizeof(T)); | 152 | 2.19M | _union.indirect_contents.indirect = new_indirect; | 153 | 2.19M | _union.indirect_contents.capacity = new_capacity; | 154 | 2.19M | _size += N + 1; | 155 | 2.19M | } | 156 | 2.27M | } | 157 | 116M | } |
prevector<16u, unsigned char, unsigned int, int>::change_capacity(unsigned int) Line | Count | Source | 128 | 1.55M | void change_capacity(size_type new_capacity) { | 129 | 1.55M | if (new_capacity <= N) { | 130 | 1.55M | if (!is_direct()) { | 131 | 0 | T* indirect = indirect_ptr(0); | 132 | 0 | T* src = indirect; | 133 | 0 | T* dst = direct_ptr(0); | 134 | 0 | memcpy(dst, src, size() * sizeof(T)); | 135 | 0 | free(indirect); | 136 | 0 | _size -= N + 1; | 137 | 0 | } | 138 | 1.55M | } else { | 139 | 2.50k | if (!is_direct()) { | 140 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 141 | | success. These should instead use an allocator or new/delete so that handlers | 142 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 143 | 0 | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 144 | 0 | assert(_union.indirect_contents.indirect); | 145 | 0 | _union.indirect_contents.capacity = new_capacity; | 146 | 2.50k | } else { | 147 | 2.50k | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 148 | 2.50k | assert(new_indirect); | 149 | 2.50k | T* src = direct_ptr(0); | 150 | 2.50k | T* dst = reinterpret_cast<T*>(new_indirect); | 151 | 2.50k | memcpy(dst, src, size() * sizeof(T)); | 152 | 2.50k | _union.indirect_contents.indirect = new_indirect; | 153 | 2.50k | _union.indirect_contents.capacity = new_capacity; | 154 | 2.50k | _size += N + 1; | 155 | 2.50k | } | 156 | 2.50k | } | 157 | 1.55M | } |
prevector<33u, unsigned char, unsigned int, int>::change_capacity(unsigned int) Line | Count | Source | 128 | 135k | void change_capacity(size_type new_capacity) { | 129 | 135k | if (new_capacity <= N) { | 130 | 135k | if (!is_direct()) { | 131 | 0 | T* indirect = indirect_ptr(0); | 132 | 0 | T* src = indirect; | 133 | 0 | T* dst = direct_ptr(0); | 134 | 0 | memcpy(dst, src, size() * sizeof(T)); | 135 | 0 | free(indirect); | 136 | 0 | _size -= N + 1; | 137 | 0 | } | 138 | 135k | } else { | 139 | 0 | if (!is_direct()) { | 140 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 141 | | success. These should instead use an allocator or new/delete so that handlers | 142 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 143 | 0 | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 144 | 0 | assert(_union.indirect_contents.indirect); | 145 | 0 | _union.indirect_contents.capacity = new_capacity; | 146 | 0 | } else { | 147 | 0 | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 148 | 0 | assert(new_indirect); | 149 | 0 | T* src = direct_ptr(0); | 150 | 0 | T* dst = reinterpret_cast<T*>(new_indirect); | 151 | 0 | memcpy(dst, src, size() * sizeof(T)); | 152 | 0 | _union.indirect_contents.indirect = new_indirect; | 153 | 0 | _union.indirect_contents.capacity = new_capacity; | 154 | 0 | _size += N + 1; | 155 | 0 | } | 156 | 0 | } | 157 | 135k | } |
prevector<8u, int, unsigned int, int>::change_capacity(unsigned int) Line | Count | Source | 128 | 539k | void change_capacity(size_type new_capacity) { | 129 | 539k | if (new_capacity <= N) { | 130 | 344k | if (!is_direct()) { | 131 | 615 | T* indirect = indirect_ptr(0); | 132 | 615 | T* src = indirect; | 133 | 615 | T* dst = direct_ptr(0); | 134 | 615 | memcpy(dst, src, size() * sizeof(T)); | 135 | 615 | free(indirect); | 136 | 615 | _size -= N + 1; | 137 | 615 | } | 138 | 344k | } else { | 139 | 195k | if (!is_direct()) { | 140 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 141 | | success. These should instead use an allocator or new/delete so that handlers | 142 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 143 | 4.00k | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 144 | 4.00k | assert(_union.indirect_contents.indirect); | 145 | 4.00k | _union.indirect_contents.capacity = new_capacity; | 146 | 191k | } else { | 147 | 191k | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 148 | 191k | assert(new_indirect); | 149 | 191k | T* src = direct_ptr(0); | 150 | 191k | T* dst = reinterpret_cast<T*>(new_indirect); | 151 | 191k | memcpy(dst, src, size() * sizeof(T)); | 152 | 191k | _union.indirect_contents.indirect = new_indirect; | 153 | 191k | _union.indirect_contents.capacity = new_capacity; | 154 | 191k | _size += N + 1; | 155 | 191k | } | 156 | 195k | } | 157 | 539k | } |
Unexecuted instantiation: prevector<4u, Network, unsigned int, int>::change_capacity(unsigned int) prevector<35u, unsigned char, unsigned int, int>::change_capacity(unsigned int) Line | Count | Source | 128 | 301 | void change_capacity(size_type new_capacity) { | 129 | 301 | if (new_capacity <= N) { | 130 | 301 | if (!is_direct()) { | 131 | 0 | T* indirect = indirect_ptr(0); | 132 | 0 | T* src = indirect; | 133 | 0 | T* dst = direct_ptr(0); | 134 | 0 | memcpy(dst, src, size() * sizeof(T)); | 135 | 0 | free(indirect); | 136 | 0 | _size -= N + 1; | 137 | 0 | } | 138 | 301 | } else { | 139 | 0 | if (!is_direct()) { | 140 | | /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 141 | | success. These should instead use an allocator or new/delete so that handlers | 142 | | are called as necessary, but performance would be slightly degraded by doing so. */ | 143 | 0 | _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 144 | 0 | assert(_union.indirect_contents.indirect); | 145 | 0 | _union.indirect_contents.capacity = new_capacity; | 146 | 0 | } else { | 147 | 0 | char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 148 | 0 | assert(new_indirect); | 149 | 0 | T* src = direct_ptr(0); | 150 | 0 | T* dst = reinterpret_cast<T*>(new_indirect); | 151 | 0 | memcpy(dst, src, size() * sizeof(T)); | 152 | 0 | _union.indirect_contents.indirect = new_indirect; | 153 | 0 | _union.indirect_contents.capacity = new_capacity; | 154 | 0 | _size += N + 1; | 155 | 0 | } | 156 | 0 | } | 157 | 301 | } |
|
158 | | |
159 | 141M | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }prevector<36u, unsigned char, unsigned int, int>::item_ptr(int) Line | Count | Source | 159 | 121M | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
prevector<16u, unsigned char, unsigned int, int>::item_ptr(int) Line | Count | Source | 159 | 2.20M | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
prevector<33u, unsigned char, unsigned int, int>::item_ptr(int) Line | Count | Source | 159 | 787k | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
prevector<8u, int, unsigned int, int>::item_ptr(int) Line | Count | Source | 159 | 16.7M | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
prevector<4u, Network, unsigned int, int>::item_ptr(int) Line | Count | Source | 159 | 984 | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
prevector<35u, unsigned char, unsigned int, int>::item_ptr(int) Line | Count | Source | 159 | 2.40k | T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
|
160 | 1.84G | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }prevector<36u, unsigned char, unsigned int, int>::item_ptr(int) const Line | Count | Source | 160 | 1.82G | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
prevector<16u, unsigned char, unsigned int, int>::item_ptr(int) const Line | Count | Source | 160 | 17.5M | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
prevector<8u, int, unsigned int, int>::item_ptr(int) const Line | Count | Source | 160 | 3.73M | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
prevector<33u, unsigned char, unsigned int, int>::item_ptr(int) const Line | Count | Source | 160 | 135k | const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); } |
|
161 | | |
162 | 1.28M | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { |
163 | 1.28M | std::fill_n(dst, count, value); |
164 | 1.28M | } prevector<36u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&) Line | Count | Source | 162 | 640k | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 163 | 640k | std::fill_n(dst, count, value); | 164 | 640k | } |
prevector<16u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&) Line | Count | Source | 162 | 356k | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 163 | 356k | std::fill_n(dst, count, value); | 164 | 356k | } |
prevector<33u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&) Line | Count | Source | 162 | 264k | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 163 | 264k | std::fill_n(dst, count, value); | 164 | 264k | } |
prevector<8u, int, unsigned int, int>::fill(int*, long, int const&) Line | Count | Source | 162 | 22.9k | void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 163 | 22.9k | std::fill_n(dst, count, value); | 164 | 22.9k | } |
|
165 | | |
166 | | template <std::input_iterator InputIterator> |
167 | 51.8M | void fill(T* dst, InputIterator first, InputIterator last) { |
168 | 15.4G | while (first != last) { |
169 | 15.3G | new(static_cast<void*>(dst)) T(*first); |
170 | 15.3G | ++dst; |
171 | 15.3G | ++first; |
172 | 15.3G | } |
173 | 51.8M | } void prevector<36u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*) Line | Count | Source | 167 | 393 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 1.42k | while (first != last) { | 169 | 1.02k | new(static_cast<void*>(dst)) T(*first); | 170 | 1.02k | ++dst; | 171 | 1.02k | ++first; | 172 | 1.02k | } | 173 | 393 | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>) Line | Count | Source | 167 | 2.81M | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 85.3M | while (first != last) { | 169 | 82.4M | new(static_cast<void*>(dst)) T(*first); | 170 | 82.4M | ++dst; | 171 | 82.4M | ++first; | 172 | 82.4M | } | 173 | 2.81M | } |
void prevector<16u, unsigned char, unsigned int, int>::fill<prevector<16u, unsigned char, unsigned int, int>::const_iterator>(unsigned char*, prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator) Line | Count | Source | 167 | 1.24M | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 6.67M | while (first != last) { | 169 | 5.43M | new(static_cast<void*>(dst)) T(*first); | 170 | 5.43M | ++dst; | 171 | 5.43M | ++first; | 172 | 5.43M | } | 173 | 1.24M | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(unsigned char*, prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator) Line | Count | Source | 167 | 46.9M | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 15.2G | while (first != last) { | 169 | 15.2G | new(static_cast<void*>(dst)) T(*first); | 170 | 15.2G | ++dst; | 171 | 15.2G | ++first; | 172 | 15.2G | } | 173 | 46.9M | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>) Line | Count | Source | 167 | 221k | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 24.0M | while (first != last) { | 169 | 23.8M | new(static_cast<void*>(dst)) T(*first); | 170 | 23.8M | ++dst; | 171 | 23.8M | ++first; | 172 | 23.8M | } | 173 | 221k | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>) Line | Count | Source | 167 | 41.8k | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 1.75M | while (first != last) { | 169 | 1.70M | new(static_cast<void*>(dst)) T(*first); | 170 | 1.70M | ++dst; | 171 | 1.70M | ++first; | 172 | 1.70M | } | 173 | 41.8k | } |
void prevector<33u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*) Line | Count | Source | 167 | 1 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 33 | while (first != last) { | 169 | 32 | new(static_cast<void*>(dst)) T(*first); | 170 | 32 | ++dst; | 171 | 32 | ++first; | 172 | 32 | } | 173 | 1 | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<prevector<36u, unsigned char, unsigned int, int>::iterator>(unsigned char*, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator) Line | Count | Source | 167 | 23.0k | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 37.3M | while (first != last) { | 169 | 37.3M | new(static_cast<void*>(dst)) T(*first); | 170 | 37.3M | ++dst; | 171 | 37.3M | ++first; | 172 | 37.3M | } | 173 | 23.0k | } |
void prevector<8u, int, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>>(int*, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>) Line | Count | Source | 167 | 265k | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 2.27M | while (first != last) { | 169 | 2.01M | new(static_cast<void*>(dst)) T(*first); | 170 | 2.01M | ++dst; | 171 | 2.01M | ++first; | 172 | 2.01M | } | 173 | 265k | } |
void prevector<8u, int, unsigned int, int>::fill<prevector<8u, int, unsigned int, int>::iterator>(int*, prevector<8u, int, unsigned int, int>::iterator, prevector<8u, int, unsigned int, int>::iterator) Line | Count | Source | 167 | 265k | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 2.27M | while (first != last) { | 169 | 2.01M | new(static_cast<void*>(dst)) T(*first); | 170 | 2.01M | ++dst; | 171 | 2.01M | ++first; | 172 | 2.01M | } | 173 | 265k | } |
void prevector<8u, int, unsigned int, int>::fill<int*>(int*, int*, int*) Line | Count | Source | 167 | 4.00k | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 14.0k | while (first != last) { | 169 | 10.0k | new(static_cast<void*>(dst)) T(*first); | 170 | 10.0k | ++dst; | 171 | 10.0k | ++first; | 172 | 10.0k | } | 173 | 4.00k | } |
void prevector<8u, int, unsigned int, int>::fill<prevector<8u, int, unsigned int, int>::const_iterator>(int*, prevector<8u, int, unsigned int, int>::const_iterator, prevector<8u, int, unsigned int, int>::const_iterator) Line | Count | Source | 167 | 8.40k | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 54.1k | while (first != last) { | 169 | 45.7k | new(static_cast<void*>(dst)) T(*first); | 170 | 45.7k | ++dst; | 171 | 45.7k | ++first; | 172 | 45.7k | } | 173 | 8.40k | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>) Line | Count | Source | 167 | 7 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 35 | while (first != last) { | 169 | 28 | new(static_cast<void*>(dst)) T(*first); | 170 | 28 | ++dst; | 171 | 28 | ++first; | 172 | 28 | } | 173 | 7 | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>) Line | Count | Source | 167 | 4 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 36 | while (first != last) { | 169 | 32 | new(static_cast<void*>(dst)) T(*first); | 170 | 32 | ++dst; | 171 | 32 | ++first; | 172 | 32 | } | 173 | 4 | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>) Line | Count | Source | 167 | 6 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 12 | while (first != last) { | 169 | 6 | new(static_cast<void*>(dst)) T(*first); | 170 | 6 | ++dst; | 171 | 6 | ++first; | 172 | 6 | } | 173 | 6 | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>) Line | Count | Source | 167 | 2 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 12 | while (first != last) { | 169 | 10 | new(static_cast<void*>(dst)) T(*first); | 170 | 10 | ++dst; | 171 | 10 | ++first; | 172 | 10 | } | 173 | 2 | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>) Line | Count | Source | 167 | 7 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 28 | while (first != last) { | 169 | 21 | new(static_cast<void*>(dst)) T(*first); | 170 | 21 | ++dst; | 171 | 21 | ++first; | 172 | 21 | } | 173 | 7 | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>) Line | Count | Source | 167 | 2 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 16 | while (first != last) { | 169 | 14 | new(static_cast<void*>(dst)) T(*first); | 170 | 14 | ++dst; | 171 | 14 | ++first; | 172 | 14 | } | 173 | 2 | } |
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>) Line | Count | Source | 167 | 2 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 52 | while (first != last) { | 169 | 50 | new(static_cast<void*>(dst)) T(*first); | 170 | 50 | ++dst; | 171 | 50 | ++first; | 172 | 50 | } | 173 | 2 | } |
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>) Line | Count | Source | 167 | 10.4k | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 97.4k | while (first != last) { | 169 | 86.9k | new(static_cast<void*>(dst)) T(*first); | 170 | 86.9k | ++dst; | 171 | 86.9k | ++first; | 172 | 86.9k | } | 173 | 10.4k | } |
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*) Line | Count | Source | 167 | 11 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 121 | while (first != last) { | 169 | 110 | new(static_cast<void*>(dst)) T(*first); | 170 | 110 | ++dst; | 171 | 110 | ++first; | 172 | 110 | } | 173 | 11 | } |
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>) Line | Count | Source | 167 | 42 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 1.38k | while (first != last) { | 169 | 1.34k | new(static_cast<void*>(dst)) T(*first); | 170 | 1.34k | ++dst; | 171 | 1.34k | ++first; | 172 | 1.34k | } | 173 | 42 | } |
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*) Line | Count | Source | 167 | 62.0k | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 310k | while (first != last) { | 169 | 248k | new(static_cast<void*>(dst)) T(*first); | 170 | 248k | ++dst; | 171 | 248k | ++first; | 172 | 248k | } | 173 | 62.0k | } |
void prevector<35u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>) Line | Count | Source | 167 | 301 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 9.93k | while (first != last) { | 169 | 9.63k | new(static_cast<void*>(dst)) T(*first); | 170 | 9.63k | ++dst; | 171 | 9.63k | ++first; | 172 | 9.63k | } | 173 | 301 | } |
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*) Line | Count | Source | 167 | 301 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 903 | while (first != last) { | 169 | 602 | new(static_cast<void*>(dst)) T(*first); | 170 | 602 | ++dst; | 171 | 602 | ++first; | 172 | 602 | } | 173 | 301 | } |
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*) Line | Count | Source | 167 | 301 | void fill(T* dst, InputIterator first, InputIterator last) { | 168 | 602 | while (first != last) { | 169 | 301 | new(static_cast<void*>(dst)) T(*first); | 170 | 301 | ++dst; | 171 | 301 | ++first; | 172 | 301 | } | 173 | 301 | } |
|
174 | | |
175 | | public: |
176 | 144k | void assign(size_type n, const T& val) { |
177 | 144k | clear(); |
178 | 144k | if (capacity() < n) { |
179 | 94.8k | change_capacity(n); |
180 | 94.8k | } |
181 | 144k | _size += n; |
182 | 144k | fill(item_ptr(0), n, val); |
183 | 144k | } prevector<36u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&) Line | Count | Source | 176 | 144k | void assign(size_type n, const T& val) { | 177 | 144k | clear(); | 178 | 144k | if (capacity() < n) { | 179 | 94.7k | change_capacity(n); | 180 | 94.7k | } | 181 | 144k | _size += n; | 182 | 144k | fill(item_ptr(0), n, val); | 183 | 144k | } |
prevector<16u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&) Line | Count | Source | 176 | 6 | void assign(size_type n, const T& val) { | 177 | 6 | clear(); | 178 | 6 | if (capacity() < n) { | 179 | 0 | change_capacity(n); | 180 | 0 | } | 181 | 6 | _size += n; | 182 | 6 | fill(item_ptr(0), n, val); | 183 | 6 | } |
prevector<8u, int, unsigned int, int>::assign(unsigned int, int const&) Line | Count | Source | 176 | 268 | void assign(size_type n, const T& val) { | 177 | 268 | clear(); | 178 | 268 | if (capacity() < n) { | 179 | 127 | change_capacity(n); | 180 | 127 | } | 181 | 268 | _size += n; | 182 | 268 | fill(item_ptr(0), n, val); | 183 | 268 | } |
|
184 | | |
185 | | template <std::input_iterator InputIterator> |
186 | 2.33M | void assign(InputIterator first, InputIterator last) { |
187 | 2.33M | size_type n = last - first; |
188 | 2.33M | clear(); |
189 | 2.33M | if (capacity() < n) { |
190 | 124k | change_capacity(n); |
191 | 124k | } |
192 | 2.33M | _size += n; |
193 | 2.33M | fill(item_ptr(0), first, last); |
194 | 2.33M | } void prevector<16u, unsigned char, unsigned int, int>::assign<prevector<16u, unsigned char, unsigned int, int>::const_iterator>(prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator) Line | Count | Source | 186 | 48.2k | void assign(InputIterator first, InputIterator last) { | 187 | 48.2k | size_type n = last - first; | 188 | 48.2k | clear(); | 189 | 48.2k | if (capacity() < n) { | 190 | 73 | change_capacity(n); | 191 | 73 | } | 192 | 48.2k | _size += n; | 193 | 48.2k | fill(item_ptr(0), first, last); | 194 | 48.2k | } |
void prevector<36u, unsigned char, unsigned int, int>::assign<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator) Line | Count | Source | 186 | 2.20M | void assign(InputIterator first, InputIterator last) { | 187 | 2.20M | size_type n = last - first; | 188 | 2.20M | clear(); | 189 | 2.20M | if (capacity() < n) { | 190 | 123k | change_capacity(n); | 191 | 123k | } | 192 | 2.20M | _size += n; | 193 | 2.20M | fill(item_ptr(0), first, last); | 194 | 2.20M | } |
void prevector<8u, int, unsigned int, int>::assign<prevector<8u, int, unsigned int, int>::const_iterator>(prevector<8u, int, unsigned int, int>::const_iterator, prevector<8u, int, unsigned int, int>::const_iterator) Line | Count | Source | 186 | 8.40k | void assign(InputIterator first, InputIterator last) { | 187 | 8.40k | size_type n = last - first; | 188 | 8.40k | clear(); | 189 | 8.40k | if (capacity() < n) { | 190 | 577 | change_capacity(n); | 191 | 577 | } | 192 | 8.40k | _size += n; | 193 | 8.40k | fill(item_ptr(0), first, last); | 194 | 8.40k | } |
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>) Line | Count | Source | 186 | 10.4k | void assign(InputIterator first, InputIterator last) { | 187 | 10.4k | size_type n = last - first; | 188 | 10.4k | clear(); | 189 | 10.4k | if (capacity() < n) { | 190 | 90 | change_capacity(n); | 191 | 90 | } | 192 | 10.4k | _size += n; | 193 | 10.4k | fill(item_ptr(0), first, last); | 194 | 10.4k | } |
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char*>(unsigned char*, unsigned char*) Line | Count | Source | 186 | 11 | void assign(InputIterator first, InputIterator last) { | 187 | 11 | size_type n = last - first; | 188 | 11 | clear(); | 189 | 11 | if (capacity() < n) { | 190 | 0 | change_capacity(n); | 191 | 0 | } | 192 | 11 | _size += n; | 193 | 11 | fill(item_ptr(0), first, last); | 194 | 11 | } |
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>) Line | Count | Source | 186 | 42 | void assign(InputIterator first, InputIterator last) { | 187 | 42 | size_type n = last - first; | 188 | 42 | clear(); | 189 | 42 | if (capacity() < n) { | 190 | 41 | change_capacity(n); | 191 | 41 | } | 192 | 42 | _size += n; | 193 | 42 | fill(item_ptr(0), first, last); | 194 | 42 | } |
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char const*>(unsigned char const*, unsigned char const*) Line | Count | Source | 186 | 62.0k | void assign(InputIterator first, InputIterator last) { | 187 | 62.0k | size_type n = last - first; | 188 | 62.0k | clear(); | 189 | 62.0k | if (capacity() < n) { | 190 | 0 | change_capacity(n); | 191 | 0 | } | 192 | 62.0k | _size += n; | 193 | 62.0k | fill(item_ptr(0), first, last); | 194 | 62.0k | } |
|
195 | | |
196 | 81.3M | prevector() = default; prevector<36u, unsigned char, unsigned int, int>::prevector() Line | Count | Source | 196 | 80.8M | prevector() = default; |
prevector<33u, unsigned char, unsigned int, int>::prevector() Line | Count | Source | 196 | 503k | prevector() = default; |
prevector<8u, int, unsigned int, int>::prevector() Line | Count | Source | 196 | 128 | prevector() = default; |
prevector<4u, Network, unsigned int, int>::prevector() Line | Count | Source | 196 | 340 | prevector() = default; |
|
197 | | |
198 | | explicit prevector(size_type n) { |
199 | | resize(n); |
200 | | } |
201 | | |
202 | 491k | explicit prevector(size_type n, const T& val) { |
203 | 491k | change_capacity(n); |
204 | 491k | _size += n; |
205 | 491k | fill(item_ptr(0), n, val); |
206 | 491k | } prevector<33u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&) Line | Count | Source | 202 | 135k | explicit prevector(size_type n, const T& val) { | 203 | 135k | change_capacity(n); | 204 | 135k | _size += n; | 205 | 135k | fill(item_ptr(0), n, val); | 206 | 135k | } |
prevector<16u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&) Line | Count | Source | 202 | 356k | explicit prevector(size_type n, const T& val) { | 203 | 356k | change_capacity(n); | 204 | 356k | _size += n; | 205 | 356k | fill(item_ptr(0), n, val); | 206 | 356k | } |
|
207 | | |
208 | | template <std::input_iterator InputIterator> |
209 | 1.17M | prevector(InputIterator first, InputIterator last) { |
210 | 1.17M | size_type n = last - first; |
211 | 1.17M | change_capacity(n); |
212 | 1.17M | _size += n; |
213 | 1.17M | fill(item_ptr(0), first, last); |
214 | 1.17M | } prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>) Line | Count | Source | 209 | 221k | prevector(InputIterator first, InputIterator last) { | 210 | 221k | size_type n = last - first; | 211 | 221k | change_capacity(n); | 212 | 221k | _size += n; | 213 | 221k | fill(item_ptr(0), first, last); | 214 | 221k | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>) Line | Count | Source | 209 | 38.9k | prevector(InputIterator first, InputIterator last) { | 210 | 38.9k | size_type n = last - first; | 211 | 38.9k | change_capacity(n); | 212 | 38.9k | _size += n; | 213 | 38.9k | fill(item_ptr(0), first, last); | 214 | 38.9k | } |
prevector<33u, unsigned char, unsigned int, int>::prevector<unsigned char*>(unsigned char*, unsigned char*) Line | Count | Source | 209 | 1 | prevector(InputIterator first, InputIterator last) { | 210 | 1 | size_type n = last - first; | 211 | 1 | change_capacity(n); | 212 | 1 | _size += n; | 213 | 1 | fill(item_ptr(0), first, last); | 214 | 1 | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<unsigned char const*>(unsigned char const*, unsigned char const*) Line | Count | Source | 209 | 13 | prevector(InputIterator first, InputIterator last) { | 210 | 13 | size_type n = last - first; | 211 | 13 | change_capacity(n); | 212 | 13 | _size += n; | 213 | 13 | fill(item_ptr(0), first, last); | 214 | 13 | } |
prevector<8u, int, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>) Line | Count | Source | 209 | 265k | prevector(InputIterator first, InputIterator last) { | 210 | 265k | size_type n = last - first; | 211 | 265k | change_capacity(n); | 212 | 265k | _size += n; | 213 | 265k | fill(item_ptr(0), first, last); | 214 | 265k | } |
prevector<8u, int, unsigned int, int>::prevector<prevector<8u, int, unsigned int, int>::iterator>(prevector<8u, int, unsigned int, int>::iterator, prevector<8u, int, unsigned int, int>::iterator) Line | Count | Source | 209 | 265k | prevector(InputIterator first, InputIterator last) { | 210 | 265k | size_type n = last - first; | 211 | 265k | change_capacity(n); | 212 | 265k | _size += n; | 213 | 265k | fill(item_ptr(0), first, last); | 214 | 265k | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>) Line | Count | Source | 209 | 8.04k | prevector(InputIterator first, InputIterator last) { | 210 | 8.04k | size_type n = last - first; | 211 | 8.04k | change_capacity(n); | 212 | 8.04k | _size += n; | 213 | 8.04k | fill(item_ptr(0), first, last); | 214 | 8.04k | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>) Line | Count | Source | 209 | 7 | prevector(InputIterator first, InputIterator last) { | 210 | 7 | size_type n = last - first; | 211 | 7 | change_capacity(n); | 212 | 7 | _size += n; | 213 | 7 | fill(item_ptr(0), first, last); | 214 | 7 | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>) Line | Count | Source | 209 | 4 | prevector(InputIterator first, InputIterator last) { | 210 | 4 | size_type n = last - first; | 211 | 4 | change_capacity(n); | 212 | 4 | _size += n; | 213 | 4 | fill(item_ptr(0), first, last); | 214 | 4 | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>) Line | Count | Source | 209 | 6 | prevector(InputIterator first, InputIterator last) { | 210 | 6 | size_type n = last - first; | 211 | 6 | change_capacity(n); | 212 | 6 | _size += n; | 213 | 6 | fill(item_ptr(0), first, last); | 214 | 6 | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>) Line | Count | Source | 209 | 2 | prevector(InputIterator first, InputIterator last) { | 210 | 2 | size_type n = last - first; | 211 | 2 | change_capacity(n); | 212 | 2 | _size += n; | 213 | 2 | fill(item_ptr(0), first, last); | 214 | 2 | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>) Line | Count | Source | 209 | 7 | prevector(InputIterator first, InputIterator last) { | 210 | 7 | size_type n = last - first; | 211 | 7 | change_capacity(n); | 212 | 7 | _size += n; | 213 | 7 | fill(item_ptr(0), first, last); | 214 | 7 | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>) Line | Count | Source | 209 | 2 | prevector(InputIterator first, InputIterator last) { | 210 | 2 | size_type n = last - first; | 211 | 2 | change_capacity(n); | 212 | 2 | _size += n; | 213 | 2 | fill(item_ptr(0), first, last); | 214 | 2 | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>) Line | Count | Source | 209 | 2 | prevector(InputIterator first, InputIterator last) { | 210 | 2 | size_type n = last - first; | 211 | 2 | change_capacity(n); | 212 | 2 | _size += n; | 213 | 2 | fill(item_ptr(0), first, last); | 214 | 2 | } |
prevector<36u, unsigned char, unsigned int, int>::prevector<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator) Line | Count | Source | 209 | 377k | prevector(InputIterator first, InputIterator last) { | 210 | 377k | size_type n = last - first; | 211 | 377k | change_capacity(n); | 212 | 377k | _size += n; | 213 | 377k | fill(item_ptr(0), first, last); | 214 | 377k | } |
prevector<35u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>) Line | Count | Source | 209 | 301 | prevector(InputIterator first, InputIterator last) { | 210 | 301 | size_type n = last - first; | 211 | 301 | change_capacity(n); | 212 | 301 | _size += n; | 213 | 301 | fill(item_ptr(0), first, last); | 214 | 301 | } |
|
215 | | |
216 | 42.7M | prevector(const prevector<N, T, Size, Diff>& other) { |
217 | 42.7M | size_type n = other.size(); |
218 | 42.7M | change_capacity(n); |
219 | 42.7M | _size += n; |
220 | 42.7M | fill(item_ptr(0), other.begin(), other.end()); |
221 | 42.7M | } prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int> const&) Line | Count | Source | 216 | 1.19M | prevector(const prevector<N, T, Size, Diff>& other) { | 217 | 1.19M | size_type n = other.size(); | 218 | 1.19M | change_capacity(n); | 219 | 1.19M | _size += n; | 220 | 1.19M | fill(item_ptr(0), other.begin(), other.end()); | 221 | 1.19M | } |
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int> const&) Line | Count | Source | 216 | 41.5M | prevector(const prevector<N, T, Size, Diff>& other) { | 217 | 41.5M | size_type n = other.size(); | 218 | 41.5M | change_capacity(n); | 219 | 41.5M | _size += n; | 220 | 41.5M | fill(item_ptr(0), other.begin(), other.end()); | 221 | 41.5M | } |
|
222 | | |
223 | | prevector(prevector<N, T, Size, Diff>&& other) noexcept |
224 | 16.3M | : _union(std::move(other._union)), _size(other._size) |
225 | 16.3M | { |
226 | 16.3M | other._size = 0; |
227 | 16.3M | } prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int>&&) Line | Count | Source | 224 | 31.6k | : _union(std::move(other._union)), _size(other._size) | 225 | 31.6k | { | 226 | 31.6k | other._size = 0; | 227 | 31.6k | } |
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int>&&) Line | Count | Source | 224 | 16.3M | : _union(std::move(other._union)), _size(other._size) | 225 | 16.3M | { | 226 | 16.3M | other._size = 0; | 227 | 16.3M | } |
|
228 | | |
229 | 2.27M | prevector& operator=(const prevector<N, T, Size, Diff>& other) { |
230 | 2.27M | if (&other == this) { |
231 | 12.8k | return *this; |
232 | 12.8k | } |
233 | 2.26M | assign(other.begin(), other.end()); |
234 | 2.26M | return *this; |
235 | 2.27M | } prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int> const&) Line | Count | Source | 229 | 48.2k | prevector& operator=(const prevector<N, T, Size, Diff>& other) { | 230 | 48.2k | if (&other == this) { | 231 | 2 | return *this; | 232 | 2 | } | 233 | 48.2k | assign(other.begin(), other.end()); | 234 | 48.2k | return *this; | 235 | 48.2k | } |
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int> const&) Line | Count | Source | 229 | 2.21M | prevector& operator=(const prevector<N, T, Size, Diff>& other) { | 230 | 2.21M | if (&other == this) { | 231 | 12.8k | return *this; | 232 | 12.8k | } | 233 | 2.20M | assign(other.begin(), other.end()); | 234 | 2.20M | return *this; | 235 | 2.21M | } |
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int> const&) Line | Count | Source | 229 | 8.40k | prevector& operator=(const prevector<N, T, Size, Diff>& other) { | 230 | 8.40k | if (&other == this) { | 231 | 0 | return *this; | 232 | 0 | } | 233 | 8.40k | assign(other.begin(), other.end()); | 234 | 8.40k | return *this; | 235 | 8.40k | } |
|
236 | | |
237 | 26.9M | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { |
238 | 26.9M | if (!is_direct()) { |
239 | 25.4k | free(_union.indirect_contents.indirect); |
240 | 25.4k | } |
241 | 26.9M | _union = std::move(other._union); |
242 | 26.9M | _size = other._size; |
243 | 26.9M | other._size = 0; |
244 | 26.9M | return *this; |
245 | 26.9M | } prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int>&&) Line | Count | Source | 237 | 92.9k | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { | 238 | 92.9k | if (!is_direct()) { | 239 | 12 | free(_union.indirect_contents.indirect); | 240 | 12 | } | 241 | 92.9k | _union = std::move(other._union); | 242 | 92.9k | _size = other._size; | 243 | 92.9k | other._size = 0; | 244 | 92.9k | return *this; | 245 | 92.9k | } |
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int>&&) Line | Count | Source | 237 | 26.8M | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { | 238 | 26.8M | if (!is_direct()) { | 239 | 22.9k | free(_union.indirect_contents.indirect); | 240 | 22.9k | } | 241 | 26.8M | _union = std::move(other._union); | 242 | 26.8M | _size = other._size; | 243 | 26.8M | other._size = 0; | 244 | 26.8M | return *this; | 245 | 26.8M | } |
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int>&&) Line | Count | Source | 237 | 4.11k | prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { | 238 | 4.11k | if (!is_direct()) { | 239 | 2.53k | free(_union.indirect_contents.indirect); | 240 | 2.53k | } | 241 | 4.11k | _union = std::move(other._union); | 242 | 4.11k | _size = other._size; | 243 | 4.11k | other._size = 0; | 244 | 4.11k | return *this; | 245 | 4.11k | } |
|
246 | | |
247 | 2.18G | size_type size() const { |
248 | 2.18G | return is_direct() ? _size : _size - N - 1; |
249 | 2.18G | } prevector<36u, unsigned char, unsigned int, int>::size() const Line | Count | Source | 247 | 2.17G | size_type size() const { | 248 | 2.17G | return is_direct() ? _size : _size - N - 1; | 249 | 2.17G | } |
prevector<16u, unsigned char, unsigned int, int>::size() const Line | Count | Source | 247 | 9.86M | size_type size() const { | 248 | 9.86M | return is_direct() ? _size : _size - N - 1; | 249 | 9.86M | } |
prevector<33u, unsigned char, unsigned int, int>::size() const Line | Count | Source | 247 | 393k | size_type size() const { | 248 | 393k | return is_direct() ? _size : _size - N - 1; | 249 | 393k | } |
prevector<8u, int, unsigned int, int>::size() const Line | Count | Source | 247 | 7.00M | size_type size() const { | 248 | 7.00M | return is_direct() ? _size : _size - N - 1; | 249 | 7.00M | } |
prevector<4u, Network, unsigned int, int>::size() const Line | Count | Source | 247 | 1.96k | size_type size() const { | 248 | 1.96k | return is_direct() ? _size : _size - N - 1; | 249 | 1.96k | } |
prevector<35u, unsigned char, unsigned int, int>::size() const Line | Count | Source | 247 | 2.10k | size_type size() const { | 248 | 2.10k | return is_direct() ? _size : _size - N - 1; | 249 | 2.10k | } |
|
250 | | |
251 | 35.4M | bool empty() const { |
252 | 35.4M | return size() == 0; |
253 | 35.4M | } prevector<36u, unsigned char, unsigned int, int>::empty() const Line | Count | Source | 251 | 35.0M | bool empty() const { | 252 | 35.0M | return size() == 0; | 253 | 35.0M | } |
prevector<16u, unsigned char, unsigned int, int>::empty() const Line | Count | Source | 251 | 100k | bool empty() const { | 252 | 100k | return size() == 0; | 253 | 100k | } |
prevector<8u, int, unsigned int, int>::empty() const Line | Count | Source | 251 | 265k | bool empty() const { | 252 | 265k | return size() == 0; | 253 | 265k | } |
prevector<4u, Network, unsigned int, int>::empty() const Line | Count | Source | 251 | 340 | bool empty() const { | 252 | 340 | return size() == 0; | 253 | 340 | } |
|
254 | | |
255 | 20.9M | iterator begin() { return iterator(item_ptr(0)); }prevector<36u, unsigned char, unsigned int, int>::begin() Line | Count | Source | 255 | 15.9M | iterator begin() { return iterator(item_ptr(0)); } |
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::begin() Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::begin() prevector<8u, int, unsigned int, int>::begin() Line | Count | Source | 255 | 4.99M | iterator begin() { return iterator(item_ptr(0)); } |
prevector<35u, unsigned char, unsigned int, int>::begin() Line | Count | Source | 255 | 602 | iterator begin() { return iterator(item_ptr(0)); } |
|
256 | 134M | const_iterator begin() const { return const_iterator(item_ptr(0)); }prevector<36u, unsigned char, unsigned int, int>::begin() const Line | Count | Source | 256 | 126M | const_iterator begin() const { return const_iterator(item_ptr(0)); } |
prevector<16u, unsigned char, unsigned int, int>::begin() const Line | Count | Source | 256 | 5.99M | const_iterator begin() const { return const_iterator(item_ptr(0)); } |
prevector<8u, int, unsigned int, int>::begin() const Line | Count | Source | 256 | 1.86M | const_iterator begin() const { return const_iterator(item_ptr(0)); } |
|
257 | 36.7M | iterator end() { return iterator(item_ptr(size())); }prevector<36u, unsigned char, unsigned int, int>::end() Line | Count | Source | 257 | 33.5M | iterator end() { return iterator(item_ptr(size())); } |
prevector<16u, unsigned char, unsigned int, int>::end() Line | Count | Source | 257 | 325k | iterator end() { return iterator(item_ptr(size())); } |
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::end() prevector<8u, int, unsigned int, int>::end() Line | Count | Source | 257 | 2.90M | iterator end() { return iterator(item_ptr(size())); } |
prevector<35u, unsigned char, unsigned int, int>::end() Line | Count | Source | 257 | 602 | iterator end() { return iterator(item_ptr(size())); } |
|
258 | 1.66G | const_iterator end() const { return const_iterator(item_ptr(size())); }prevector<36u, unsigned char, unsigned int, int>::end() const Line | Count | Source | 258 | 1.65G | const_iterator end() const { return const_iterator(item_ptr(size())); } |
prevector<16u, unsigned char, unsigned int, int>::end() const Line | Count | Source | 258 | 1.71M | const_iterator end() const { return const_iterator(item_ptr(size())); } |
prevector<8u, int, unsigned int, int>::end() const Line | Count | Source | 258 | 1.86M | const_iterator end() const { return const_iterator(item_ptr(size())); } |
|
259 | | |
260 | 19.6M | size_t capacity() const { |
261 | 19.6M | if (is_direct()) { |
262 | 13.7M | return N; |
263 | 13.7M | } else { |
264 | 5.89M | return _union.indirect_contents.capacity; |
265 | 5.89M | } |
266 | 19.6M | } prevector<36u, unsigned char, unsigned int, int>::capacity() const Line | Count | Source | 260 | 19.2M | size_t capacity() const { | 261 | 19.2M | if (is_direct()) { | 262 | 13.4M | return N; | 263 | 13.4M | } else { | 264 | 5.83M | return _union.indirect_contents.capacity; | 265 | 5.83M | } | 266 | 19.2M | } |
prevector<16u, unsigned char, unsigned int, int>::capacity() const Line | Count | Source | 260 | 121k | size_t capacity() const { | 261 | 121k | if (is_direct()) { | 262 | 121k | return N; | 263 | 121k | } else { | 264 | 11 | return _union.indirect_contents.capacity; | 265 | 11 | } | 266 | 121k | } |
prevector<8u, int, unsigned int, int>::capacity() const Line | Count | Source | 260 | 92.5k | size_t capacity() const { | 261 | 92.5k | if (is_direct()) { | 262 | 34.2k | return N; | 263 | 58.2k | } else { | 264 | 58.2k | return _union.indirect_contents.capacity; | 265 | 58.2k | } | 266 | 92.5k | } |
prevector<4u, Network, unsigned int, int>::capacity() const Line | Count | Source | 260 | 644 | size_t capacity() const { | 261 | 644 | if (is_direct()) { | 262 | 644 | return N; | 263 | 644 | } else { | 264 | 0 | return _union.indirect_contents.capacity; | 265 | 0 | } | 266 | 644 | } |
prevector<33u, unsigned char, unsigned int, int>::capacity() const Line | Count | Source | 260 | 129k | size_t capacity() const { | 261 | 129k | if (is_direct()) { | 262 | 129k | return N; | 263 | 129k | } else { | 264 | 0 | return _union.indirect_contents.capacity; | 265 | 0 | } | 266 | 129k | } |
prevector<35u, unsigned char, unsigned int, int>::capacity() const Line | Count | Source | 260 | 602 | size_t capacity() const { | 261 | 602 | if (is_direct()) { | 262 | 602 | return N; | 263 | 602 | } else { | 264 | 0 | return _union.indirect_contents.capacity; | 265 | 0 | } | 266 | 602 | } |
|
267 | | |
268 | 10.6M | T& operator[](size_type pos) { |
269 | 10.6M | return *item_ptr(pos); |
270 | 10.6M | } prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int) Line | Count | Source | 268 | 2.23M | T& operator[](size_type pos) { | 269 | 2.23M | return *item_ptr(pos); | 270 | 2.23M | } |
prevector<33u, unsigned char, unsigned int, int>::operator[](unsigned int) Line | Count | Source | 268 | 258k | T& operator[](size_type pos) { | 269 | 258k | return *item_ptr(pos); | 270 | 258k | } |
prevector<8u, int, unsigned int, int>::operator[](unsigned int) Line | Count | Source | 268 | 8.18M | T& operator[](size_type pos) { | 269 | 8.18M | return *item_ptr(pos); | 270 | 8.18M | } |
prevector<4u, Network, unsigned int, int>::operator[](unsigned int) Line | Count | Source | 268 | 340 | T& operator[](size_type pos) { | 269 | 340 | return *item_ptr(pos); | 270 | 340 | } |
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) Line | Count | Source | 268 | 5.55k | T& operator[](size_type pos) { | 269 | 5.55k | return *item_ptr(pos); | 270 | 5.55k | } |
|
271 | | |
272 | 18.9M | const T& operator[](size_type pos) const { |
273 | 18.9M | return *item_ptr(pos); |
274 | 18.9M | } prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) const Line | Count | Source | 272 | 7.53M | const T& operator[](size_type pos) const { | 273 | 7.53M | return *item_ptr(pos); | 274 | 7.53M | } |
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int) const Line | Count | Source | 272 | 11.3M | const T& operator[](size_type pos) const { | 273 | 11.3M | return *item_ptr(pos); | 274 | 11.3M | } |
|
275 | | |
276 | 77.6M | void resize(size_type new_size) { |
277 | 77.6M | size_type cur_size = size(); |
278 | 77.6M | if (cur_size == new_size) { |
279 | 67.9M | return; |
280 | 67.9M | } |
281 | 9.72M | if (cur_size > new_size) { |
282 | 9.08M | erase(item_ptr(new_size), end()); |
283 | 9.08M | return; |
284 | 9.08M | } |
285 | 632k | if (new_size > capacity()) { |
286 | 100k | change_capacity(new_size); |
287 | 100k | } |
288 | 632k | ptrdiff_t increase = new_size - cur_size; |
289 | 632k | fill(item_ptr(cur_size), increase); |
290 | 632k | _size += increase; |
291 | 632k | } prevector<36u, unsigned char, unsigned int, int>::resize(unsigned int) Line | Count | Source | 276 | 77.3M | void resize(size_type new_size) { | 277 | 77.3M | size_type cur_size = size(); | 278 | 77.3M | if (cur_size == new_size) { | 279 | 67.9M | return; | 280 | 67.9M | } | 281 | 9.40M | if (cur_size > new_size) { | 282 | 8.91M | erase(item_ptr(new_size), end()); | 283 | 8.91M | return; | 284 | 8.91M | } | 285 | 496k | if (new_size > capacity()) { | 286 | 99.9k | change_capacity(new_size); | 287 | 99.9k | } | 288 | 496k | ptrdiff_t increase = new_size - cur_size; | 289 | 496k | fill(item_ptr(cur_size), increase); | 290 | 496k | _size += increase; | 291 | 496k | } |
prevector<16u, unsigned char, unsigned int, int>::resize(unsigned int) Line | Count | Source | 276 | 162k | void resize(size_type new_size) { | 277 | 162k | size_type cur_size = size(); | 278 | 162k | if (cur_size == new_size) { | 279 | 101 | return; | 280 | 101 | } | 281 | 162k | if (cur_size > new_size) { | 282 | 162k | erase(item_ptr(new_size), end()); | 283 | 162k | return; | 284 | 162k | } | 285 | 287 | if (new_size > capacity()) { | 286 | 285 | change_capacity(new_size); | 287 | 285 | } | 288 | 287 | ptrdiff_t increase = new_size - cur_size; | 289 | 287 | fill(item_ptr(cur_size), increase); | 290 | 287 | _size += increase; | 291 | 287 | } |
prevector<8u, int, unsigned int, int>::resize(unsigned int) Line | Count | Source | 276 | 29.0k | void resize(size_type new_size) { | 277 | 29.0k | size_type cur_size = size(); | 278 | 29.0k | if (cur_size == new_size) { | 279 | 10.3k | return; | 280 | 10.3k | } | 281 | 18.6k | if (cur_size > new_size) { | 282 | 12.2k | erase(item_ptr(new_size), end()); | 283 | 12.2k | return; | 284 | 12.2k | } | 285 | 6.41k | if (new_size > capacity()) { | 286 | 271 | change_capacity(new_size); | 287 | 271 | } | 288 | 6.41k | ptrdiff_t increase = new_size - cur_size; | 289 | 6.41k | fill(item_ptr(cur_size), increase); | 290 | 6.41k | _size += increase; | 291 | 6.41k | } |
prevector<33u, unsigned char, unsigned int, int>::resize(unsigned int) Line | Count | Source | 276 | 129k | void resize(size_type new_size) { | 277 | 129k | size_type cur_size = size(); | 278 | 129k | if (cur_size == new_size) { | 279 | 0 | return; | 280 | 0 | } | 281 | 129k | if (cur_size > new_size) { | 282 | 0 | erase(item_ptr(new_size), end()); | 283 | 0 | return; | 284 | 0 | } | 285 | 129k | if (new_size > capacity()) { | 286 | 0 | change_capacity(new_size); | 287 | 0 | } | 288 | 129k | ptrdiff_t increase = new_size - cur_size; | 289 | 129k | fill(item_ptr(cur_size), increase); | 290 | 129k | _size += increase; | 291 | 129k | } |
|
292 | | |
293 | 4.25k | void reserve(size_type new_capacity) { |
294 | 4.25k | if (new_capacity > capacity()) { |
295 | 1.89k | change_capacity(new_capacity); |
296 | 1.89k | } |
297 | 4.25k | } |
298 | | |
299 | 73.1M | void shrink_to_fit() { |
300 | 73.1M | change_capacity(size()); |
301 | 73.1M | } prevector<36u, unsigned char, unsigned int, int>::shrink_to_fit() Line | Count | Source | 299 | 73.1M | void shrink_to_fit() { | 300 | 73.1M | change_capacity(size()); | 301 | 73.1M | } |
prevector<8u, int, unsigned int, int>::shrink_to_fit() Line | Count | Source | 299 | 2.01k | void shrink_to_fit() { | 300 | 2.01k | change_capacity(size()); | 301 | 2.01k | } |
|
302 | | |
303 | 76.9M | void clear() { |
304 | 76.9M | resize(0); |
305 | 76.9M | } prevector<36u, unsigned char, unsigned int, int>::clear() Line | Count | Source | 303 | 76.8M | void clear() { | 304 | 76.8M | resize(0); | 305 | 76.8M | } |
prevector<16u, unsigned char, unsigned int, int>::clear() Line | Count | Source | 303 | 120k | void clear() { | 304 | 120k | resize(0); | 305 | 120k | } |
prevector<8u, int, unsigned int, int>::clear() Line | Count | Source | 303 | 12.9k | void clear() { | 304 | 12.9k | resize(0); | 305 | 12.9k | } |
|
306 | | |
307 | 9.66M | iterator insert(iterator pos, const T& value) { |
308 | 9.66M | size_type p = pos - begin(); |
309 | 9.66M | size_type new_size = size() + 1; |
310 | 9.66M | if (capacity() < new_size) { |
311 | 7.96k | change_capacity(new_size + (new_size >> 1)); |
312 | 7.96k | } |
313 | 9.66M | T* ptr = item_ptr(p); |
314 | 9.66M | T* dst = ptr + 1; |
315 | 9.66M | memmove(dst, ptr, (size() - p) * sizeof(T)); |
316 | 9.66M | _size++; |
317 | 9.66M | new(static_cast<void*>(ptr)) T(value); |
318 | 9.66M | return iterator(ptr); |
319 | 9.66M | } prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const&) Line | Count | Source | 307 | 9.63M | iterator insert(iterator pos, const T& value) { | 308 | 9.63M | size_type p = pos - begin(); | 309 | 9.63M | size_type new_size = size() + 1; | 310 | 9.63M | if (capacity() < new_size) { | 311 | 6.66k | change_capacity(new_size + (new_size >> 1)); | 312 | 6.66k | } | 313 | 9.63M | T* ptr = item_ptr(p); | 314 | 9.63M | T* dst = ptr + 1; | 315 | 9.63M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 316 | 9.63M | _size++; | 317 | 9.63M | new(static_cast<void*>(ptr)) T(value); | 318 | 9.63M | return iterator(ptr); | 319 | 9.63M | } |
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, int const&) Line | Count | Source | 307 | 32.4k | iterator insert(iterator pos, const T& value) { | 308 | 32.4k | size_type p = pos - begin(); | 309 | 32.4k | size_type new_size = size() + 1; | 310 | 32.4k | if (capacity() < new_size) { | 311 | 1.30k | change_capacity(new_size + (new_size >> 1)); | 312 | 1.30k | } | 313 | 32.4k | T* ptr = item_ptr(p); | 314 | 32.4k | T* dst = ptr + 1; | 315 | 32.4k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 316 | 32.4k | _size++; | 317 | 32.4k | new(static_cast<void*>(ptr)) T(value); | 318 | 32.4k | return iterator(ptr); | 319 | 32.4k | } |
|
320 | | |
321 | 16.3k | void insert(iterator pos, size_type count, const T& value) { |
322 | 16.3k | size_type p = pos - begin(); |
323 | 16.3k | size_type new_size = size() + count; |
324 | 16.3k | if (capacity() < new_size) { |
325 | 762 | change_capacity(new_size + (new_size >> 1)); |
326 | 762 | } |
327 | 16.3k | T* ptr = item_ptr(p); |
328 | 16.3k | T* dst = ptr + count; |
329 | 16.3k | memmove(dst, ptr, (size() - p) * sizeof(T)); |
330 | 16.3k | _size += count; |
331 | 16.3k | fill(item_ptr(p), count, value); |
332 | 16.3k | } prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, unsigned int, int const&) Line | Count | Source | 321 | 16.3k | void insert(iterator pos, size_type count, const T& value) { | 322 | 16.3k | size_type p = pos - begin(); | 323 | 16.3k | size_type new_size = size() + count; | 324 | 16.3k | if (capacity() < new_size) { | 325 | 755 | change_capacity(new_size + (new_size >> 1)); | 326 | 755 | } | 327 | 16.3k | T* ptr = item_ptr(p); | 328 | 16.3k | T* dst = ptr + count; | 329 | 16.3k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 330 | 16.3k | _size += count; | 331 | 16.3k | fill(item_ptr(p), count, value); | 332 | 16.3k | } |
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned int, unsigned char const&) Line | Count | Source | 321 | 7 | void insert(iterator pos, size_type count, const T& value) { | 322 | 7 | size_type p = pos - begin(); | 323 | 7 | size_type new_size = size() + count; | 324 | 7 | if (capacity() < new_size) { | 325 | 7 | change_capacity(new_size + (new_size >> 1)); | 326 | 7 | } | 327 | 7 | T* ptr = item_ptr(p); | 328 | 7 | T* dst = ptr + count; | 329 | 7 | memmove(dst, ptr, (size() - p) * sizeof(T)); | 330 | 7 | _size += count; | 331 | 7 | fill(item_ptr(p), count, value); | 332 | 7 | } |
|
333 | | |
334 | | template <std::input_iterator InputIterator> |
335 | 5.63M | void insert(iterator pos, InputIterator first, InputIterator last) { |
336 | 5.63M | size_type p = pos - begin(); |
337 | 5.63M | difference_type count = last - first; |
338 | 5.63M | size_type new_size = size() + count; |
339 | 5.63M | if (capacity() < new_size) { |
340 | 379k | change_capacity(new_size + (new_size >> 1)); |
341 | 379k | } |
342 | 5.63M | T* ptr = item_ptr(p); |
343 | 5.63M | T* dst = ptr + count; |
344 | 5.63M | memmove(dst, ptr, (size() - p) * sizeof(T)); |
345 | 5.63M | _size += count; |
346 | 5.63M | fill(ptr, first, last); |
347 | 5.63M | } void prevector<36u, unsigned char, unsigned int, int>::insert<unsigned char const*>(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const*, unsigned char const*) Line | Count | Source | 335 | 380 | void insert(iterator pos, InputIterator first, InputIterator last) { | 336 | 380 | size_type p = pos - begin(); | 337 | 380 | difference_type count = last - first; | 338 | 380 | size_type new_size = size() + count; | 339 | 380 | if (capacity() < new_size) { | 340 | 0 | change_capacity(new_size + (new_size >> 1)); | 341 | 0 | } | 342 | 380 | T* ptr = item_ptr(p); | 343 | 380 | T* dst = ptr + count; | 344 | 380 | memmove(dst, ptr, (size() - p) * sizeof(T)); | 345 | 380 | _size += count; | 346 | 380 | fill(ptr, first, last); | 347 | 380 | } |
void prevector<36u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(prevector<36u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>) Line | Count | Source | 335 | 2.80M | void insert(iterator pos, InputIterator first, InputIterator last) { | 336 | 2.80M | size_type p = pos - begin(); | 337 | 2.80M | difference_type count = last - first; | 338 | 2.80M | size_type new_size = size() + count; | 339 | 2.80M | if (capacity() < new_size) { | 340 | 232k | change_capacity(new_size + (new_size >> 1)); | 341 | 232k | } | 342 | 2.80M | T* ptr = item_ptr(p); | 343 | 2.80M | T* dst = ptr + count; | 344 | 2.80M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 345 | 2.80M | _size += count; | 346 | 2.80M | fill(ptr, first, last); | 347 | 2.80M | } |
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator) Line | Count | Source | 335 | 23.0k | void insert(iterator pos, InputIterator first, InputIterator last) { | 336 | 23.0k | size_type p = pos - begin(); | 337 | 23.0k | difference_type count = last - first; | 338 | 23.0k | size_type new_size = size() + count; | 339 | 23.0k | if (capacity() < new_size) { | 340 | 17.3k | change_capacity(new_size + (new_size >> 1)); | 341 | 17.3k | } | 342 | 23.0k | T* ptr = item_ptr(p); | 343 | 23.0k | T* dst = ptr + count; | 344 | 23.0k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 345 | 23.0k | _size += count; | 346 | 23.0k | fill(ptr, first, last); | 347 | 23.0k | } |
void prevector<8u, int, unsigned int, int>::insert<int*>(prevector<8u, int, unsigned int, int>::iterator, int*, int*) Line | Count | Source | 335 | 4.00k | void insert(iterator pos, InputIterator first, InputIterator last) { | 336 | 4.00k | size_type p = pos - begin(); | 337 | 4.00k | difference_type count = last - first; | 338 | 4.00k | size_type new_size = size() + count; | 339 | 4.00k | if (capacity() < new_size) { | 340 | 302 | change_capacity(new_size + (new_size >> 1)); | 341 | 302 | } | 342 | 4.00k | T* ptr = item_ptr(p); | 343 | 4.00k | T* dst = ptr + count; | 344 | 4.00k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 345 | 4.00k | _size += count; | 346 | 4.00k | fill(ptr, first, last); | 347 | 4.00k | } |
void prevector<36u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(prevector<36u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>) Line | Count | Source | 335 | 2.88k | void insert(iterator pos, InputIterator first, InputIterator last) { | 336 | 2.88k | size_type p = pos - begin(); | 337 | 2.88k | difference_type count = last - first; | 338 | 2.88k | size_type new_size = size() + count; | 339 | 2.88k | if (capacity() < new_size) { | 340 | 255 | change_capacity(new_size + (new_size >> 1)); | 341 | 255 | } | 342 | 2.88k | T* ptr = item_ptr(p); | 343 | 2.88k | T* dst = ptr + count; | 344 | 2.88k | memmove(dst, ptr, (size() - p) * sizeof(T)); | 345 | 2.88k | _size += count; | 346 | 2.88k | fill(ptr, first, last); | 347 | 2.88k | } |
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator) Line | Count | Source | 335 | 2.79M | void insert(iterator pos, InputIterator first, InputIterator last) { | 336 | 2.79M | size_type p = pos - begin(); | 337 | 2.79M | difference_type count = last - first; | 338 | 2.79M | size_type new_size = size() + count; | 339 | 2.79M | if (capacity() < new_size) { | 340 | 128k | change_capacity(new_size + (new_size >> 1)); | 341 | 128k | } | 342 | 2.79M | T* ptr = item_ptr(p); | 343 | 2.79M | T* dst = ptr + count; | 344 | 2.79M | memmove(dst, ptr, (size() - p) * sizeof(T)); | 345 | 2.79M | _size += count; | 346 | 2.79M | fill(ptr, first, last); | 347 | 2.79M | } |
void prevector<35u, unsigned char, unsigned int, int>::insert<unsigned char*>(prevector<35u, unsigned char, unsigned int, int>::iterator, unsigned char*, unsigned char*) Line | Count | Source | 335 | 301 | void insert(iterator pos, InputIterator first, InputIterator last) { | 336 | 301 | size_type p = pos - begin(); | 337 | 301 | difference_type count = last - first; | 338 | 301 | size_type new_size = size() + count; | 339 | 301 | if (capacity() < new_size) { | 340 | 0 | change_capacity(new_size + (new_size >> 1)); | 341 | 0 | } | 342 | 301 | T* ptr = item_ptr(p); | 343 | 301 | T* dst = ptr + count; | 344 | 301 | memmove(dst, ptr, (size() - p) * sizeof(T)); | 345 | 301 | _size += count; | 346 | 301 | fill(ptr, first, last); | 347 | 301 | } |
void prevector<35u, unsigned char, unsigned int, int>::insert<unsigned char const*>(prevector<35u, unsigned char, unsigned int, int>::iterator, unsigned char const*, unsigned char const*) Line | Count | Source | 335 | 301 | void insert(iterator pos, InputIterator first, InputIterator last) { | 336 | 301 | size_type p = pos - begin(); | 337 | 301 | difference_type count = last - first; | 338 | 301 | size_type new_size = size() + count; | 339 | 301 | if (capacity() < new_size) { | 340 | 0 | change_capacity(new_size + (new_size >> 1)); | 341 | 0 | } | 342 | 301 | T* ptr = item_ptr(p); | 343 | 301 | T* dst = ptr + count; | 344 | 301 | memmove(dst, ptr, (size() - p) * sizeof(T)); | 345 | 301 | _size += count; | 346 | 301 | fill(ptr, first, last); | 347 | 301 | } |
|
348 | | |
349 | 1.08M | inline void resize_uninitialized(size_type new_size) { |
350 | | // resize_uninitialized changes the size of the prevector but does not initialize it. |
351 | | // If size < new_size, the added elements must be initialized explicitly. |
352 | 1.08M | if (capacity() < new_size) { |
353 | 236k | change_capacity(new_size); |
354 | 236k | _size += new_size - size(); |
355 | 236k | return; |
356 | 236k | } |
357 | 850k | if (new_size < size()) { |
358 | 3.07k | erase(item_ptr(new_size), end()); |
359 | 847k | } else { |
360 | 847k | _size += new_size - size(); |
361 | 847k | } |
362 | 850k | } prevector<36u, unsigned char, unsigned int, int>::resize_uninitialized(unsigned int) Line | Count | Source | 349 | 1.07M | inline void resize_uninitialized(size_type new_size) { | 350 | | // resize_uninitialized changes the size of the prevector but does not initialize it. | 351 | | // If size < new_size, the added elements must be initialized explicitly. | 352 | 1.07M | if (capacity() < new_size) { | 353 | 235k | change_capacity(new_size); | 354 | 235k | _size += new_size - size(); | 355 | 235k | return; | 356 | 235k | } | 357 | 843k | if (new_size < size()) { | 358 | 0 | erase(item_ptr(new_size), end()); | 359 | 843k | } else { | 360 | 843k | _size += new_size - size(); | 361 | 843k | } | 362 | 843k | } |
prevector<8u, int, unsigned int, int>::resize_uninitialized(unsigned int) Line | Count | Source | 349 | 7.91k | inline void resize_uninitialized(size_type new_size) { | 350 | | // resize_uninitialized changes the size of the prevector but does not initialize it. | 351 | | // If size < new_size, the added elements must be initialized explicitly. | 352 | 7.91k | if (capacity() < new_size) { | 353 | 1.12k | change_capacity(new_size); | 354 | 1.12k | _size += new_size - size(); | 355 | 1.12k | return; | 356 | 1.12k | } | 357 | 6.78k | if (new_size < size()) { | 358 | 3.07k | erase(item_ptr(new_size), end()); | 359 | 3.71k | } else { | 360 | 3.71k | _size += new_size - size(); | 361 | 3.71k | } | 362 | 6.78k | } |
|
363 | | |
364 | 27.5k | iterator erase(iterator pos) { |
365 | 27.5k | return erase(pos, pos + 1); |
366 | 27.5k | } |
367 | | |
368 | 9.14M | iterator erase(iterator first, iterator last) { |
369 | | // Erase is not allowed to the change the object's capacity. That means |
370 | | // that when starting with an indirectly allocated prevector with |
371 | | // size and capacity > N, the result may be a still indirectly allocated |
372 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is |
373 | | // necessary to switch to the (more efficient) directly allocated |
374 | | // representation (with capacity N and size <= N). |
375 | 9.14M | iterator p = first; |
376 | 9.14M | char* endp = (char*)&(*end()); |
377 | 9.14M | _size -= last - p; |
378 | 9.14M | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); |
379 | 9.14M | return first; |
380 | 9.14M | } prevector<36u, unsigned char, unsigned int, int>::erase(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator) Line | Count | Source | 368 | 8.91M | iterator erase(iterator first, iterator last) { | 369 | | // Erase is not allowed to the change the object's capacity. That means | 370 | | // that when starting with an indirectly allocated prevector with | 371 | | // size and capacity > N, the result may be a still indirectly allocated | 372 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 373 | | // necessary to switch to the (more efficient) directly allocated | 374 | | // representation (with capacity N and size <= N). | 375 | 8.91M | iterator p = first; | 376 | 8.91M | char* endp = (char*)&(*end()); | 377 | 8.91M | _size -= last - p; | 378 | 8.91M | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 379 | 8.91M | return first; | 380 | 8.91M | } |
prevector<16u, unsigned char, unsigned int, int>::erase(prevector<16u, unsigned char, unsigned int, int>::iterator, prevector<16u, unsigned char, unsigned int, int>::iterator) Line | Count | Source | 368 | 162k | iterator erase(iterator first, iterator last) { | 369 | | // Erase is not allowed to the change the object's capacity. That means | 370 | | // that when starting with an indirectly allocated prevector with | 371 | | // size and capacity > N, the result may be a still indirectly allocated | 372 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 373 | | // necessary to switch to the (more efficient) directly allocated | 374 | | // representation (with capacity N and size <= N). | 375 | 162k | iterator p = first; | 376 | 162k | char* endp = (char*)&(*end()); | 377 | 162k | _size -= last - p; | 378 | 162k | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 379 | 162k | return first; | 380 | 162k | } |
prevector<8u, int, unsigned int, int>::erase(prevector<8u, int, unsigned int, int>::iterator, prevector<8u, int, unsigned int, int>::iterator) Line | Count | Source | 368 | 69.9k | iterator erase(iterator first, iterator last) { | 369 | | // Erase is not allowed to the change the object's capacity. That means | 370 | | // that when starting with an indirectly allocated prevector with | 371 | | // size and capacity > N, the result may be a still indirectly allocated | 372 | | // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 373 | | // necessary to switch to the (more efficient) directly allocated | 374 | | // representation (with capacity N and size <= N). | 375 | 69.9k | iterator p = first; | 376 | 69.9k | char* endp = (char*)&(*end()); | 377 | 69.9k | _size -= last - p; | 378 | 69.9k | memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 379 | 69.9k | return first; | 380 | 69.9k | } |
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::erase(prevector<33u, unsigned char, unsigned int, int>::iterator, prevector<33u, unsigned char, unsigned int, int>::iterator) |
381 | | |
382 | | template<typename... Args> |
383 | 82.6k | void emplace_back(Args&&... args) { |
384 | 82.6k | size_type new_size = size() + 1; |
385 | 82.6k | if (capacity() < new_size) { |
386 | 13.3k | change_capacity(new_size + (new_size >> 1)); |
387 | 13.3k | } |
388 | 82.6k | new(item_ptr(size())) T(std::forward<Args>(args)...); |
389 | 82.6k | _size++; |
390 | 82.6k | } void prevector<36u, unsigned char, unsigned int, int>::emplace_back<unsigned char const&>(unsigned char const&) Line | Count | Source | 383 | 73.7k | void emplace_back(Args&&... args) { | 384 | 73.7k | size_type new_size = size() + 1; | 385 | 73.7k | if (capacity() < new_size) { | 386 | 13.0k | change_capacity(new_size + (new_size >> 1)); | 387 | 13.0k | } | 388 | 73.7k | new(item_ptr(size())) T(std::forward<Args>(args)...); | 389 | 73.7k | _size++; | 390 | 73.7k | } |
void prevector<8u, int, unsigned int, int>::emplace_back<int const&>(int const&) Line | Count | Source | 383 | 8.25k | void emplace_back(Args&&... args) { | 384 | 8.25k | size_type new_size = size() + 1; | 385 | 8.25k | if (capacity() < new_size) { | 386 | 228 | change_capacity(new_size + (new_size >> 1)); | 387 | 228 | } | 388 | 8.25k | new(item_ptr(size())) T(std::forward<Args>(args)...); | 389 | 8.25k | _size++; | 390 | 8.25k | } |
void prevector<4u, Network, unsigned int, int>::emplace_back<Network const&>(Network const&) Line | Count | Source | 383 | 644 | void emplace_back(Args&&... args) { | 384 | 644 | size_type new_size = size() + 1; | 385 | 644 | if (capacity() < new_size) { | 386 | 0 | change_capacity(new_size + (new_size >> 1)); | 387 | 0 | } | 388 | 644 | new(item_ptr(size())) T(std::forward<Args>(args)...); | 389 | 644 | _size++; | 390 | 644 | } |
|
391 | | |
392 | 82.6k | void push_back(const T& value) { |
393 | 82.6k | emplace_back(value); |
394 | 82.6k | } prevector<36u, unsigned char, unsigned int, int>::push_back(unsigned char const&) Line | Count | Source | 392 | 73.7k | void push_back(const T& value) { | 393 | 73.7k | emplace_back(value); | 394 | 73.7k | } |
prevector<8u, int, unsigned int, int>::push_back(int const&) Line | Count | Source | 392 | 8.25k | void push_back(const T& value) { | 393 | 8.25k | emplace_back(value); | 394 | 8.25k | } |
prevector<4u, Network, unsigned int, int>::push_back(Network const&) Line | Count | Source | 392 | 644 | void push_back(const T& value) { | 393 | 644 | emplace_back(value); | 394 | 644 | } |
|
395 | | |
396 | 6.67k | void pop_back() { |
397 | 6.67k | erase(end() - 1, end()); |
398 | 6.67k | } |
399 | | |
400 | | T& front() { |
401 | | return *item_ptr(0); |
402 | | } |
403 | | |
404 | | const T& front() const { |
405 | | return *item_ptr(0); |
406 | | } |
407 | | |
408 | | T& back() { |
409 | | return *item_ptr(size() - 1); |
410 | | } |
411 | | |
412 | 28.1k | const T& back() const { |
413 | 28.1k | return *item_ptr(size() - 1); |
414 | 28.1k | } |
415 | | |
416 | | void swap(prevector<N, T, Size, Diff>& other) noexcept |
417 | 16.3k | { |
418 | 16.3k | std::swap(_union, other._union); |
419 | 16.3k | std::swap(_size, other._size); |
420 | 16.3k | } |
421 | | |
422 | 142M | ~prevector() { |
423 | 142M | if (!is_direct()) { |
424 | 2.31M | free(_union.indirect_contents.indirect); |
425 | 2.31M | _union.indirect_contents.indirect = nullptr; |
426 | 2.31M | } |
427 | 142M | } prevector<16u, unsigned char, unsigned int, int>::~prevector() Line | Count | Source | 422 | 1.56M | ~prevector() { | 423 | 1.56M | if (!is_direct()) { | 424 | 2.49k | free(_union.indirect_contents.indirect); | 425 | 2.49k | _union.indirect_contents.indirect = nullptr; | 426 | 2.49k | } | 427 | 1.56M | } |
prevector<36u, unsigned char, unsigned int, int>::~prevector() Line | Count | Source | 422 | 139M | ~prevector() { | 423 | 139M | if (!is_direct()) { | 424 | 2.12M | free(_union.indirect_contents.indirect); | 425 | 2.12M | _union.indirect_contents.indirect = nullptr; | 426 | 2.12M | } | 427 | 139M | } |
prevector<33u, unsigned char, unsigned int, int>::~prevector() Line | Count | Source | 422 | 638k | ~prevector() { | 423 | 638k | if (!is_direct()) { | 424 | 0 | free(_union.indirect_contents.indirect); | 425 | 0 | _union.indirect_contents.indirect = nullptr; | 426 | 0 | } | 427 | 638k | } |
prevector<8u, int, unsigned int, int>::~prevector() Line | Count | Source | 422 | 531k | ~prevector() { | 423 | 531k | if (!is_direct()) { | 424 | 188k | free(_union.indirect_contents.indirect); | 425 | 188k | _union.indirect_contents.indirect = nullptr; | 426 | 188k | } | 427 | 531k | } |
prevector<4u, Network, unsigned int, int>::~prevector() Line | Count | Source | 422 | 340 | ~prevector() { | 423 | 340 | if (!is_direct()) { | 424 | 0 | free(_union.indirect_contents.indirect); | 425 | 0 | _union.indirect_contents.indirect = nullptr; | 426 | 0 | } | 427 | 340 | } |
prevector<35u, unsigned char, unsigned int, int>::~prevector() Line | Count | Source | 422 | 301 | ~prevector() { | 423 | 301 | if (!is_direct()) { | 424 | 0 | free(_union.indirect_contents.indirect); | 425 | 0 | _union.indirect_contents.indirect = nullptr; | 426 | 0 | } | 427 | 301 | } |
|
428 | | |
429 | 7.24M | constexpr bool operator==(const prevector& other) const { |
430 | 7.24M | return std::ranges::equal(*this, other); |
431 | 7.24M | } prevector<36u, unsigned char, unsigned int, int>::operator==(prevector<36u, unsigned char, unsigned int, int> const&) const Line | Count | Source | 429 | 6.49M | constexpr bool operator==(const prevector& other) const { | 430 | 6.49M | return std::ranges::equal(*this, other); | 431 | 6.49M | } |
prevector<8u, int, unsigned int, int>::operator==(prevector<8u, int, unsigned int, int> const&) const Line | Count | Source | 429 | 531k | constexpr bool operator==(const prevector& other) const { | 430 | 531k | return std::ranges::equal(*this, other); | 431 | 531k | } |
prevector<16u, unsigned char, unsigned int, int>::operator==(prevector<16u, unsigned char, unsigned int, int> const&) const Line | Count | Source | 429 | 221k | constexpr bool operator==(const prevector& other) const { | 430 | 221k | return std::ranges::equal(*this, other); | 431 | 221k | } |
|
432 | | |
433 | 22.9M | bool operator<(const prevector<N, T, Size, Diff>& other) const { |
434 | 22.9M | if (size() < other.size()) { |
435 | 957k | return true; |
436 | 957k | } |
437 | 22.0M | if (size() > other.size()) { |
438 | 312k | return false; |
439 | 312k | } |
440 | 21.7M | const_iterator b1 = begin(); |
441 | 21.7M | const_iterator b2 = other.begin(); |
442 | 21.7M | const_iterator e1 = end(); |
443 | 133M | while (b1 != e1) { |
444 | 130M | if ((*b1) < (*b2)) { |
445 | 10.8M | return true; |
446 | 10.8M | } |
447 | 119M | if ((*b2) < (*b1)) { |
448 | 8.31M | return false; |
449 | 8.31M | } |
450 | 111M | ++b1; |
451 | 111M | ++b2; |
452 | 111M | } |
453 | 2.50M | return false; |
454 | 21.7M | } prevector<36u, unsigned char, unsigned int, int>::operator<(prevector<36u, unsigned char, unsigned int, int> const&) const Line | Count | Source | 433 | 22.9M | bool operator<(const prevector<N, T, Size, Diff>& other) const { | 434 | 22.9M | if (size() < other.size()) { | 435 | 957k | return true; | 436 | 957k | } | 437 | 21.9M | if (size() > other.size()) { | 438 | 312k | return false; | 439 | 312k | } | 440 | 21.6M | const_iterator b1 = begin(); | 441 | 21.6M | const_iterator b2 = other.begin(); | 442 | 21.6M | const_iterator e1 = end(); | 443 | 133M | while (b1 != e1) { | 444 | 130M | if ((*b1) < (*b2)) { | 445 | 10.8M | return true; | 446 | 10.8M | } | 447 | 119M | if ((*b2) < (*b1)) { | 448 | 8.31M | return false; | 449 | 8.31M | } | 450 | 111M | ++b1; | 451 | 111M | ++b2; | 452 | 111M | } | 453 | 2.48M | return false; | 454 | 21.6M | } |
prevector<16u, unsigned char, unsigned int, int>::operator<(prevector<16u, unsigned char, unsigned int, int> const&) const Line | Count | Source | 433 | 26.8k | bool operator<(const prevector<N, T, Size, Diff>& other) const { | 434 | 26.8k | if (size() < other.size()) { | 435 | 0 | return true; | 436 | 0 | } | 437 | 26.8k | if (size() > other.size()) { | 438 | 0 | return false; | 439 | 0 | } | 440 | 26.8k | const_iterator b1 = begin(); | 441 | 26.8k | const_iterator b2 = other.begin(); | 442 | 26.8k | const_iterator e1 = end(); | 443 | 132k | while (b1 != e1) { | 444 | 107k | if ((*b1) < (*b2)) { | 445 | 929 | return true; | 446 | 929 | } | 447 | 106k | if ((*b2) < (*b1)) { | 448 | 294 | return false; | 449 | 294 | } | 450 | 105k | ++b1; | 451 | 105k | ++b2; | 452 | 105k | } | 453 | 25.5k | return false; | 454 | 26.8k | } |
|
455 | | |
456 | 35.8M | size_t allocated_memory() const { |
457 | 35.8M | if (is_direct()) { |
458 | 34.8M | return 0; |
459 | 34.8M | } else { |
460 | 914k | return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity; |
461 | 914k | } |
462 | 35.8M | } |
463 | | |
464 | 655k | value_type* data() { |
465 | 655k | return item_ptr(0); |
466 | 655k | } prevector<16u, unsigned char, unsigned int, int>::data() Line | Count | Source | 464 | 42.0k | value_type* data() { | 465 | 42.0k | return item_ptr(0); | 466 | 42.0k | } |
prevector<33u, unsigned char, unsigned int, int>::data() Line | Count | Source | 464 | 264k | value_type* data() { | 465 | 264k | return item_ptr(0); | 466 | 264k | } |
prevector<36u, unsigned char, unsigned int, int>::data() Line | Count | Source | 464 | 349k | value_type* data() { | 465 | 349k | return item_ptr(0); | 466 | 349k | } |
prevector<35u, unsigned char, unsigned int, int>::data() Line | Count | Source | 464 | 301 | value_type* data() { | 465 | 301 | return item_ptr(0); | 466 | 301 | } |
|
467 | | |
468 | 35.1M | const value_type* data() const { |
469 | 35.1M | return item_ptr(0); |
470 | 35.1M | } prevector<16u, unsigned char, unsigned int, int>::data() const Line | Count | Source | 468 | 2.34M | const value_type* data() const { | 469 | 2.34M | return item_ptr(0); | 470 | 2.34M | } |
prevector<36u, unsigned char, unsigned int, int>::data() const Line | Count | Source | 468 | 32.6M | const value_type* data() const { | 469 | 32.6M | return item_ptr(0); | 470 | 32.6M | } |
prevector<33u, unsigned char, unsigned int, int>::data() const Line | Count | Source | 468 | 135k | const value_type* data() const { | 469 | 135k | return item_ptr(0); | 470 | 135k | } |
|
471 | | }; |
472 | | |
473 | | #endif // BITCOIN_PREVECTOR_H |