/Users/eugenesiegel/btc/bitcoin/src/prevector.h
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | // Copyright (c) 2015-present The Bitcoin Core developers | 
| 2 |  | // Distributed under the MIT software license, see the accompanying | 
| 3 |  | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | 
| 4 |  |  | 
| 5 |  | #ifndef BITCOIN_PREVECTOR_H | 
| 6 |  | #define BITCOIN_PREVECTOR_H | 
| 7 |  |  | 
| 8 |  | #include <algorithm> | 
| 9 |  | #include <cassert> | 
| 10 |  | #include <cstddef> | 
| 11 |  | #include <cstdint> | 
| 12 |  | #include <cstdlib> | 
| 13 |  | #include <cstring> | 
| 14 |  | #include <iterator> | 
| 15 |  | #include <type_traits> | 
| 16 |  | #include <utility> | 
| 17 |  |  | 
| 18 |  | /** Implements a drop-in replacement for std::vector<T> which stores up to N | 
| 19 |  |  *  elements directly (without heap allocation). The types Size and Diff are | 
| 20 |  |  *  used to store element counts, and can be any unsigned + signed type. | 
| 21 |  |  * | 
| 22 |  |  *  Storage layout is either: | 
| 23 |  |  *  - Direct allocation: | 
| 24 |  |  *    - Size _size: the number of used elements (between 0 and N) | 
| 25 |  |  *    - T direct[N]: an array of N elements of type T | 
| 26 |  |  *      (only the first _size are initialized). | 
| 27 |  |  *  - Indirect allocation: | 
| 28 |  |  *    - Size _size: the number of used elements plus N + 1 | 
| 29 |  |  *    - Size capacity: the number of allocated elements | 
| 30 |  |  *    - T* indirect: a pointer to an array of capacity elements of type T | 
| 31 |  |  *      (only the first _size are initialized). | 
| 32 |  |  * | 
| 33 |  |  *  The data type T must be movable by memmove/realloc(). Once we switch to C++, | 
| 34 |  |  *  move constructors can be used instead. | 
| 35 |  |  */ | 
| 36 |  | template<unsigned int N, typename T, typename Size = uint32_t, typename Diff = int32_t> | 
| 37 |  | class prevector { | 
| 38 |  |     static_assert(std::is_trivially_copyable_v<T>); | 
| 39 |  |  | 
| 40 |  | public: | 
| 41 |  |     static constexpr unsigned int STATIC_SIZE{N}; | 
| 42 |  |  | 
| 43 |  |     typedef Size size_type; | 
| 44 |  |     typedef Diff difference_type; | 
| 45 |  |     typedef T value_type; | 
| 46 |  |     typedef value_type& reference; | 
| 47 |  |     typedef const value_type& const_reference; | 
| 48 |  |     typedef value_type* pointer; | 
| 49 |  |     typedef const value_type* const_pointer; | 
| 50 |  |  | 
| 51 |  |     class iterator { | 
| 52 |  |         T* ptr{}; | 
| 53 |  |     public: | 
| 54 |  |         typedef Diff difference_type; | 
| 55 |  |         typedef T* pointer; | 
| 56 |  |         typedef T& reference; | 
| 57 |  |         using element_type = T; | 
| 58 |  |         using iterator_category = std::contiguous_iterator_tag; | 
| 59 |  |         iterator() = default; | 
| 60 | 54.5M |         iterator(T* ptr_) : ptr(ptr_) {}_ZN9prevectorILj16EhjiE8iteratorC2EPh| Line | Count | Source |  | 60 | 2.63M |         iterator(T* ptr_) : ptr(ptr_) {} | 
_ZN9prevectorILj36EhjiE8iteratorC2EPh| Line | Count | Source |  | 60 | 51.8M |         iterator(T* ptr_) : ptr(ptr_) {} | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE8iteratorC2EPiUnexecuted instantiation: _ZN9prevectorILj33EhjiE8iteratorC2EPh_ZN9prevectorILj35EhjiE8iteratorC2EPh| Line | Count | Source |  | 60 | 956 |         iterator(T* ptr_) : ptr(ptr_) {} | 
 | 
| 61 | 67.8M |         T& operator*() const { return *ptr; }_ZNK9prevectorILj36EhjiE8iteratordeEv| Line | Count | Source |  | 61 | 62.5M |         T& operator*() const { return *ptr; } | 
_ZNK9prevectorILj16EhjiE8iteratordeEv| Line | Count | Source |  | 61 | 5.27M |         T& operator*() const { return *ptr; } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE8iteratordeEvUnexecuted instantiation: _ZNK9prevectorILj33EhjiE8iteratordeEv_ZNK9prevectorILj35EhjiE8iteratordeEv| Line | Count | Source |  | 61 | 956 |         T& operator*() const { return *ptr; } | 
 | 
| 62 | 4.06M |         T* operator->() const { return ptr; } | 
| 63 |  |         T& operator[](size_type pos) const { return ptr[pos]; } | 
| 64 | 0 |         iterator& operator++() { ptr++; return *this; } | 
| 65 |  |         iterator& operator--() { ptr--; return *this; } | 
| 66 |  |         iterator operator++(int) { iterator copy(*this); ++(*this); return copy; } | 
| 67 |  |         iterator operator--(int) { iterator copy(*this); --(*this); return copy; } | 
| 68 | 19.9M |         difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }_ZmiN9prevectorILj36EhjiE8iteratorES1_| Line | Count | Source |  | 68 | 19.0M |         difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } | 
_ZmiN9prevectorILj16EhjiE8iteratorES1_| Line | Count | Source |  | 68 | 878k |         difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } | 
Unexecuted instantiation: _ZmiN9prevectorILj8EijiE8iteratorES1_Unexecuted instantiation: _ZmiN9prevectorILj33EhjiE8iteratorES1__ZmiN9prevectorILj35EhjiE8iteratorES1_| Line | Count | Source |  | 68 | 478 |         difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); } | 
 | 
| 69 | 0 |         iterator operator+(size_type n) const { return iterator(ptr + n); }Unexecuted instantiation: _ZNK9prevectorILj36EhjiE8iteratorplEjUnexecuted instantiation: _ZNK9prevectorILj8EijiE8iteratorplEjUnexecuted instantiation: _ZNK9prevectorILj33EhjiE8iteratorplEj | 
| 70 |  |         iterator friend operator+(size_type n, iterator x) { return x + n; } | 
| 71 |  |         iterator& operator+=(size_type n) { ptr += n; return *this; } | 
| 72 | 0 |         iterator operator-(size_type n) const { return iterator(ptr - n); } | 
| 73 |  |         iterator& operator-=(size_type n) { ptr -= n; return *this; } | 
| 74 |  |         bool operator==(iterator x) const { return ptr == x.ptr; } | 
| 75 | 0 |         bool operator!=(iterator x) const { return ptr != x.ptr; } | 
| 76 |  |         bool operator>=(iterator x) const { return ptr >= x.ptr; } | 
| 77 |  |         bool operator<=(iterator x) const { return ptr <= x.ptr; } | 
| 78 |  |         bool operator>(iterator x) const { return ptr > x.ptr; } | 
| 79 |  |         bool operator<(iterator x) const { return ptr < x.ptr; } | 
| 80 |  |     }; | 
| 81 |  |  | 
| 82 |  |     class const_iterator { | 
| 83 |  |         const T* ptr{}; | 
| 84 |  |     public: | 
| 85 |  |         typedef Diff difference_type; | 
| 86 |  |         typedef const T* pointer; | 
| 87 |  |         typedef const T& reference; | 
| 88 |  |         using element_type = const T; | 
| 89 |  |         using iterator_category = std::contiguous_iterator_tag; | 
| 90 |  |         const_iterator() = default; | 
| 91 | 262M |         const_iterator(const T* ptr_) : ptr(ptr_) {}_ZN9prevectorILj16EhjiE14const_iteratorC2EPKh| Line | Count | Source |  | 91 | 7.90M |         const_iterator(const T* ptr_) : ptr(ptr_) {} | 
_ZN9prevectorILj36EhjiE14const_iteratorC2EPKh| Line | Count | Source |  | 91 | 254M |         const_iterator(const T* ptr_) : ptr(ptr_) {} | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE14const_iteratorC2EPKi | 
| 92 | 0 |         const_iterator(iterator x) : ptr(&(*x)) {} | 
| 93 | 2.17G |         const T& operator*() const { return *ptr; }_ZNK9prevectorILj36EhjiE14const_iteratordeEv| Line | Count | Source |  | 93 | 2.13G |         const T& operator*() const { return *ptr; } | 
_ZNK9prevectorILj16EhjiE14const_iteratordeEv| Line | Count | Source |  | 93 | 35.0M |         const T& operator*() const { return *ptr; } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratordeEv | 
| 94 | 18.0M |         const T* operator->() const { return ptr; }_ZNK9prevectorILj16EhjiE14const_iteratorptEv| Line | Count | Source |  | 94 | 1.94M |         const T* operator->() const { return ptr; } | 
_ZNK9prevectorILj36EhjiE14const_iteratorptEv| Line | Count | Source |  | 94 | 16.1M |         const T* operator->() const { return ptr; } | 
 | 
| 95 | 0 |         const T& operator[](size_type pos) const { return ptr[pos]; }Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratorixEjUnexecuted instantiation: _ZNK9prevectorILj36EhjiE14const_iteratorixEj | 
| 96 | 2.05G |         const_iterator& operator++() { ptr++; return *this; }_ZN9prevectorILj36EhjiE14const_iteratorppEv| Line | Count | Source |  | 96 | 2.02G |         const_iterator& operator++() { ptr++; return *this; } | 
_ZN9prevectorILj16EhjiE14const_iteratorppEv| Line | Count | Source |  | 96 | 34.1M |         const_iterator& operator++() { ptr++; return *this; } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE14const_iteratorppEv | 
| 97 | 0 |         const_iterator& operator--() { ptr--; return *this; } | 
| 98 | 8.91M |         const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; } | 
| 99 |  |         const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; } | 
| 100 | 46.9M |         difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }_ZmiN9prevectorILj16EhjiE14const_iteratorES1_| Line | Count | Source |  | 100 | 384k |         difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } | 
_ZmiN9prevectorILj36EhjiE14const_iteratorES1_| Line | Count | Source |  | 100 | 46.5M |         difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); } | 
Unexecuted instantiation: _ZmiN9prevectorILj8EijiE14const_iteratorES1_ | 
| 101 | 8.55M |         const_iterator operator+(size_type n) const { return const_iterator(ptr + n); }Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratorplEj_ZNK9prevectorILj36EhjiE14const_iteratorplEj| Line | Count | Source |  | 101 | 8.55M |         const_iterator operator+(size_type n) const { return const_iterator(ptr + n); } | 
 | 
| 102 |  |         const_iterator friend operator+(size_type n, const_iterator x) { return x + n; } | 
| 103 | 6.75M |         const_iterator& operator+=(size_type n) { ptr += n; return *this; } | 
| 104 | 0 |         const_iterator operator-(size_type n) const { return const_iterator(ptr - n); }Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratormiEjUnexecuted instantiation: _ZNK9prevectorILj36EhjiE14const_iteratormiEj | 
| 105 |  |         const_iterator& operator-=(size_type n) { ptr -= n; return *this; } | 
| 106 | 0 |         bool operator==(const_iterator x) const { return ptr == x.ptr; } | 
| 107 | 2.11G |         bool operator!=(const_iterator x) const { return ptr != x.ptr; }_ZNK9prevectorILj36EhjiE14const_iteratorneES1_| Line | Count | Source |  | 107 | 2.07G |         bool operator!=(const_iterator x) const { return ptr != x.ptr; } | 
_ZNK9prevectorILj16EhjiE14const_iteratorneES1_| Line | Count | Source |  | 107 | 36.9M |         bool operator!=(const_iterator x) const { return ptr != x.ptr; } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE14const_iteratorneES1_ | 
| 108 | 8.91M |         bool operator>=(const_iterator x) const { return ptr >= x.ptr; } | 
| 109 |  |         bool operator<=(const_iterator x) const { return ptr <= x.ptr; } | 
| 110 |  |         bool operator>(const_iterator x) const { return ptr > x.ptr; } | 
| 111 | 17.5M |         bool operator<(const_iterator x) const { return ptr < x.ptr; } | 
| 112 |  |     }; | 
| 113 |  |  | 
| 114 |  | private: | 
| 115 |  | #pragma pack(push, 1) | 
| 116 |  |     union direct_or_indirect { | 
| 117 |  |         char direct[sizeof(T) * N]; | 
| 118 |  |         struct { | 
| 119 |  |             char* indirect; | 
| 120 |  |             size_type capacity; | 
| 121 |  |         } indirect_contents; | 
| 122 |  |     }; | 
| 123 |  | #pragma pack(pop) | 
| 124 |  |     alignas(char*) direct_or_indirect _union = {}; | 
| 125 |  |     size_type _size = 0; | 
| 126 |  |  | 
| 127 |  |     static_assert(alignof(char*) % alignof(size_type) == 0 && sizeof(char*) % alignof(size_type) == 0, "size_type cannot have more restrictive alignment requirement than pointer"); | 
| 128 |  |     static_assert(alignof(char*) % alignof(T) == 0, "value_type T cannot have more restrictive alignment requirement than pointer"); | 
| 129 |  |  | 
| 130 | 163M |     T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }_ZN9prevectorILj36EhjiE10direct_ptrEi| Line | Count | Source |  | 130 | 156M |     T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } | 
Unexecuted instantiation: _ZN9prevectorILj33EhjiE10direct_ptrEi_ZN9prevectorILj16EhjiE10direct_ptrEi| Line | Count | Source |  | 130 | 7.74M |     T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE10direct_ptrEi_ZN9prevectorILj35EhjiE10direct_ptrEi| Line | Count | Source |  | 130 | 1.91k |     T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; } | 
 | 
| 131 | 323M |     const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }_ZNK9prevectorILj36EhjiE10direct_ptrEi| Line | Count | Source |  | 131 | 308M |     const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } | 
_ZNK9prevectorILj16EhjiE10direct_ptrEi| Line | Count | Source |  | 131 | 14.8M |     const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE10direct_ptrEiUnexecuted instantiation: _ZNK9prevectorILj33EhjiE10direct_ptrEi | 
| 132 | 28.2M |     T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }_ZN9prevectorILj36EhjiE12indirect_ptrEi| Line | Count | Source |  | 132 | 27.9M |     T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } | 
Unexecuted instantiation: _ZN9prevectorILj33EhjiE12indirect_ptrEi_ZN9prevectorILj16EhjiE12indirect_ptrEi| Line | Count | Source |  | 132 | 340k |     T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE12indirect_ptrEiUnexecuted instantiation: _ZN9prevectorILj35EhjiE12indirect_ptrEi | 
| 133 | 37.1M |     const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }_ZNK9prevectorILj36EhjiE12indirect_ptrEi| Line | Count | Source |  | 133 | 36.7M |     const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } | 
_ZNK9prevectorILj16EhjiE12indirect_ptrEi| Line | Count | Source |  | 133 | 448k |     const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE12indirect_ptrEiUnexecuted instantiation: _ZNK9prevectorILj33EhjiE12indirect_ptrEi | 
| 134 | 1.69G |     bool is_direct() const { return _size <= N; }_ZNK9prevectorILj36EhjiE9is_directEv| Line | Count | Source |  | 134 | 1.64G |     bool is_direct() const { return _size <= N; } | 
_ZNK9prevectorILj33EhjiE9is_directEv| Line | Count | Source |  | 134 | 324k |     bool is_direct() const { return _size <= N; } | 
_ZNK9prevectorILj16EhjiE9is_directEv| Line | Count | Source |  | 134 | 47.0M |     bool is_direct() const { return _size <= N; } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE9is_directEv_ZNK9prevectorILj35EhjiE9is_directEv| Line | Count | Source |  | 134 | 4.54k |     bool is_direct() const { return _size <= N; } | 
 | 
| 135 |  |  | 
| 136 | 129M |     void change_capacity(size_type new_capacity) { | 
| 137 | 129M |         if (new_capacity <= N) { | 
| 138 | 120M |             if (!is_direct()) { | 
| 139 | 0 |                 T* indirect = indirect_ptr(0); | 
| 140 | 0 |                 T* src = indirect; | 
| 141 | 0 |                 T* dst = direct_ptr(0); | 
| 142 | 0 |                 memcpy(dst, src, size() * sizeof(T)); | 
| 143 | 0 |                 free(indirect); | 
| 144 | 0 |                 _size -= N + 1; | 
| 145 | 0 |             } | 
| 146 | 120M |         } else { | 
| 147 | 9.36M |             if (!is_direct()) { | 
| 148 |  |                 /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert | 
| 149 |  |                     success. These should instead use an allocator or new/delete so that handlers | 
| 150 |  |                     are called as necessary, but performance would be slightly degraded by doing so. */ | 
| 151 | 0 |                 _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); | 
| 152 | 0 |                 assert(_union.indirect_contents.indirect); | 
| 153 | 0 |                 _union.indirect_contents.capacity = new_capacity; | 
| 154 | 9.36M |             } else { | 
| 155 | 9.36M |                 char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); | 
| 156 | 9.36M |                 assert(new_indirect); | 
| 157 | 9.36M |                 T* src = direct_ptr(0); | 
| 158 | 9.36M |                 T* dst = reinterpret_cast<T*>(new_indirect); | 
| 159 | 9.36M |                 memcpy(dst, src, size() * sizeof(T)); | 
| 160 | 9.36M |                 _union.indirect_contents.indirect = new_indirect; | 
| 161 | 9.36M |                 _union.indirect_contents.capacity = new_capacity; | 
| 162 | 9.36M |                 _size += N + 1; | 
| 163 | 9.36M |             } | 
| 164 | 9.36M |         } | 
| 165 | 129M |     } _ZN9prevectorILj36EhjiE15change_capacityEj| Line | Count | Source |  | 136 | 125M |     void change_capacity(size_type new_capacity) { |  | 137 | 125M |         if (new_capacity <= N) { |  | 138 | 116M |             if (!is_direct()) { |  | 139 | 0 |                 T* indirect = indirect_ptr(0); |  | 140 | 0 |                 T* src = indirect; |  | 141 | 0 |                 T* dst = direct_ptr(0); |  | 142 | 0 |                 memcpy(dst, src, size() * sizeof(T)); |  | 143 | 0 |                 free(indirect); |  | 144 | 0 |                 _size -= N + 1; |  | 145 | 0 |             } |  | 146 | 116M |         } else { |  | 147 | 9.08M |             if (!is_direct()) { |  | 148 |  |                 /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert |  | 149 |  |                     success. These should instead use an allocator or new/delete so that handlers |  | 150 |  |                     are called as necessary, but performance would be slightly degraded by doing so. */ |  | 151 | 0 |                 _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); |  | 152 | 0 |                 assert(_union.indirect_contents.indirect); |  | 153 | 0 |                 _union.indirect_contents.capacity = new_capacity; |  | 154 | 9.08M |             } else { |  | 155 | 9.08M |                 char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); |  | 156 | 9.08M |                 assert(new_indirect); |  | 157 | 9.08M |                 T* src = direct_ptr(0); |  | 158 | 9.08M |                 T* dst = reinterpret_cast<T*>(new_indirect); |  | 159 | 9.08M |                 memcpy(dst, src, size() * sizeof(T)); |  | 160 | 9.08M |                 _union.indirect_contents.indirect = new_indirect; |  | 161 | 9.08M |                 _union.indirect_contents.capacity = new_capacity; |  | 162 | 9.08M |                 _size += N + 1; |  | 163 | 9.08M |             } |  | 164 | 9.08M |         } |  | 165 | 125M |     } | 
_ZN9prevectorILj16EhjiE15change_capacityEj| Line | Count | Source |  | 136 | 4.21M |     void change_capacity(size_type new_capacity) { |  | 137 | 4.21M |         if (new_capacity <= N) { |  | 138 | 3.93M |             if (!is_direct()) { |  | 139 | 0 |                 T* indirect = indirect_ptr(0); |  | 140 | 0 |                 T* src = indirect; |  | 141 | 0 |                 T* dst = direct_ptr(0); |  | 142 | 0 |                 memcpy(dst, src, size() * sizeof(T)); |  | 143 | 0 |                 free(indirect); |  | 144 | 0 |                 _size -= N + 1; |  | 145 | 0 |             } |  | 146 | 3.93M |         } else { |  | 147 | 278k |             if (!is_direct()) { |  | 148 |  |                 /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert |  | 149 |  |                     success. These should instead use an allocator or new/delete so that handlers |  | 150 |  |                     are called as necessary, but performance would be slightly degraded by doing so. */ |  | 151 | 0 |                 _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); |  | 152 | 0 |                 assert(_union.indirect_contents.indirect); |  | 153 | 0 |                 _union.indirect_contents.capacity = new_capacity; |  | 154 | 278k |             } else { |  | 155 | 278k |                 char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); |  | 156 | 278k |                 assert(new_indirect); |  | 157 | 278k |                 T* src = direct_ptr(0); |  | 158 | 278k |                 T* dst = reinterpret_cast<T*>(new_indirect); |  | 159 | 278k |                 memcpy(dst, src, size() * sizeof(T)); |  | 160 | 278k |                 _union.indirect_contents.indirect = new_indirect; |  | 161 | 278k |                 _union.indirect_contents.capacity = new_capacity; |  | 162 | 278k |                 _size += N + 1; |  | 163 | 278k |             } |  | 164 | 278k |         } |  | 165 | 4.21M |     } | 
Unexecuted instantiation: _ZN9prevectorILj33EhjiE15change_capacityEjUnexecuted instantiation: _ZN9prevectorILj8EijiE15change_capacityEj_ZN9prevectorILj35EhjiE15change_capacityEj| Line | Count | Source |  | 136 | 239 |     void change_capacity(size_type new_capacity) { |  | 137 | 239 |         if (new_capacity <= N) { |  | 138 | 239 |             if (!is_direct()) { |  | 139 | 0 |                 T* indirect = indirect_ptr(0); |  | 140 | 0 |                 T* src = indirect; |  | 141 | 0 |                 T* dst = direct_ptr(0); |  | 142 | 0 |                 memcpy(dst, src, size() * sizeof(T)); |  | 143 | 0 |                 free(indirect); |  | 144 | 0 |                 _size -= N + 1; |  | 145 | 0 |             } |  | 146 | 239 |         } else { |  | 147 | 0 |             if (!is_direct()) { |  | 148 |  |                 /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert |  | 149 |  |                     success. These should instead use an allocator or new/delete so that handlers |  | 150 |  |                     are called as necessary, but performance would be slightly degraded by doing so. */ |  | 151 | 0 |                 _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity)); |  | 152 | 0 |                 assert(_union.indirect_contents.indirect); |  | 153 | 0 |                 _union.indirect_contents.capacity = new_capacity; |  | 154 | 0 |             } else { |  | 155 | 0 |                 char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity)); |  | 156 | 0 |                 assert(new_indirect); |  | 157 | 0 |                 T* src = direct_ptr(0); |  | 158 | 0 |                 T* dst = reinterpret_cast<T*>(new_indirect); |  | 159 | 0 |                 memcpy(dst, src, size() * sizeof(T)); |  | 160 | 0 |                 _union.indirect_contents.indirect = new_indirect; |  | 161 | 0 |                 _union.indirect_contents.capacity = new_capacity; |  | 162 | 0 |                 _size += N + 1; |  | 163 | 0 |             } |  | 164 | 0 |         } |  | 165 | 239 |     } | 
 | 
| 166 |  |  | 
| 167 | 182M |     T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos)154M: indirect_ptr(pos)28.2M; }_ZN9prevectorILj36EhjiE8item_ptrEi| Line | Count | Source |  | 167 | 174M |     T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos)147M: indirect_ptr(pos)27.9M; } | 
Unexecuted instantiation: _ZN9prevectorILj33EhjiE8item_ptrEi_ZN9prevectorILj16EhjiE8item_ptrEi| Line | Count | Source |  | 167 | 7.80M |     T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos)7.46M: indirect_ptr(pos)340k; } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE8item_ptrEi_ZN9prevectorILj35EhjiE8item_ptrEi| Line | Count | Source |  | 167 | 1.91k |     T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos)0; } | 
 | 
| 168 | 360M |     const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos)323M: indirect_ptr(pos)37.1M; }_ZNK9prevectorILj36EhjiE8item_ptrEi| Line | Count | Source |  | 168 | 345M |     const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos)308M: indirect_ptr(pos)36.7M; } | 
_ZNK9prevectorILj16EhjiE8item_ptrEi| Line | Count | Source |  | 168 | 15.2M |     const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos)14.8M: indirect_ptr(pos)448k; } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE8item_ptrEiUnexecuted instantiation: _ZNK9prevectorILj33EhjiE8item_ptrEi | 
| 169 |  |  | 
| 170 | 5.05M |     void fill(T* dst, ptrdiff_t count, const T& value = T{}) { | 
| 171 | 5.05M |         std::fill_n(dst, count, value); | 
| 172 | 5.05M |     } _ZN9prevectorILj36EhjiE4fillEPhlRKh| Line | Count | Source |  | 170 | 3.34M |     void fill(T* dst, ptrdiff_t count, const T& value = T{}) { |  | 171 | 3.34M |         std::fill_n(dst, count, value); |  | 172 | 3.34M |     } | 
_ZN9prevectorILj16EhjiE4fillEPhlRKh| Line | Count | Source |  | 170 | 1.70M |     void fill(T* dst, ptrdiff_t count, const T& value = T{}) { |  | 171 | 1.70M |         std::fill_n(dst, count, value); |  | 172 | 1.70M |     } | 
Unexecuted instantiation: _ZN9prevectorILj33EhjiE4fillEPhlRKhUnexecuted instantiation: _ZN9prevectorILj8EijiE4fillEPilRKi | 
| 173 |  |  | 
| 174 |  |     template <std::input_iterator InputIterator> | 
| 175 | 97.3M |     void fill(T* dst, InputIterator first, InputIterator last) { | 
| 176 | 2.14G |         while (first != last) { | 
| 177 | 2.04G |             new(static_cast<void*>(dst)) T(*first); | 
| 178 | 2.04G |             ++dst; | 
| 179 | 2.04G |             ++first; | 
| 180 | 2.04G |         } | 
| 181 | 97.3M |     } Unexecuted instantiation: _ZN9prevectorILj36EhjiE4fillITkNSt3__114input_iteratorEPKhEEvPhT_S6__ZN9prevectorILj36EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvPhT_S8_| Line | Count | Source |  | 175 | 5.00M |     void fill(T* dst, InputIterator first, InputIterator last) { |  | 176 | 52.3M |         while (first != last) { |  | 177 | 47.2M |             new(static_cast<void*>(dst)) T(*first); |  | 178 | 47.2M |             ++dst; |  | 179 | 47.2M |             ++first; |  | 180 | 47.2M |         } |  | 181 | 5.00M |     } | 
_ZN9prevectorILj36EhjiE4fillITkNSt3__114input_iteratorENS0_14const_iteratorEEEvPhT_S5_| Line | Count | Source |  | 175 | 89.2M |     void fill(T* dst, InputIterator first, InputIterator last) { |  | 176 | 2.05G |         while (first != last) { |  | 177 | 1.96G |             new(static_cast<void*>(dst)) T(*first); |  | 178 | 1.96G |             ++dst; |  | 179 | 1.96G |             ++first; |  | 180 | 1.96G |         } |  | 181 | 89.2M |     } | 
_ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorENS0_14const_iteratorEEEvPhT_S5_| Line | Count | Source |  | 175 | 2.89M |     void fill(T* dst, InputIterator first, InputIterator last) { |  | 176 | 36.6M |         while (first != last) { |  | 177 | 33.7M |             new(static_cast<void*>(dst)) T(*first); |  | 178 | 33.7M |             ++dst; |  | 179 | 33.7M |             ++first; |  | 180 | 33.7M |         } |  | 181 | 2.89M |     } | 
Unexecuted instantiation: _ZN9prevectorILj36EhjiE4fillITkNSt3__114input_iteratorENS0_8iteratorEEEvPhT_S5_Unexecuted instantiation: _ZN9prevectorILj8EijiE4fillITkNSt3__114input_iteratorEPiEEvS3_T_S4_Unexecuted instantiation: _ZN9prevectorILj8EijiE4fillITkNSt3__114input_iteratorENS0_14const_iteratorEEEvPiT_S5_Unexecuted instantiation: _ZN9prevectorILj8EijiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKiEEEEvPiT_S8_Unexecuted instantiation: _ZN9prevectorILj33EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvPhT_S8_Unexecuted instantiation: _ZN9prevectorILj36EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEEvS4_T_S6__ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvPhT_S8_| Line | Count | Source |  | 175 | 191k |     void fill(T* dst, InputIterator first, InputIterator last) { |  | 176 | 3.26M |         while (first != last) { |  | 177 | 3.06M |             new(static_cast<void*>(dst)) T(*first); |  | 178 | 3.06M |             ++dst; |  | 179 | 3.06M |             ++first; |  | 180 | 3.06M |         } |  | 181 | 191k |     } | 
_ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorEPhEEvS3_T_S4_| Line | Count | Source |  | 175 | 2.34k |     void fill(T* dst, InputIterator first, InputIterator last) { |  | 176 | 25.7k |         while (first != last) { |  | 177 | 23.4k |             new(static_cast<void*>(dst)) T(*first); |  | 178 | 23.4k |             ++dst; |  | 179 | 23.4k |             ++first; |  | 180 | 23.4k |         } |  | 181 | 2.34k |     } | 
Unexecuted instantiation: _ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEEvS4_T_S6_Unexecuted instantiation: _ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorEPKhEEvPhT_S6__ZN9prevectorILj35EhjiE4fillITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvPhT_S8_| Line | Count | Source |  | 175 | 239 |     void fill(T* dst, InputIterator first, InputIterator last) { |  | 176 | 7.88k |         while (first != last) { |  | 177 | 7.64k |             new(static_cast<void*>(dst)) T(*first); |  | 178 | 7.64k |             ++dst; |  | 179 | 7.64k |             ++first; |  | 180 | 7.64k |         } |  | 181 | 239 |     } | 
_ZN9prevectorILj35EhjiE4fillITkNSt3__114input_iteratorEPhEEvS3_T_S4_| Line | Count | Source |  | 175 | 239 |     void fill(T* dst, InputIterator first, InputIterator last) { |  | 176 | 717 |         while (first != last) { |  | 177 | 478 |             new(static_cast<void*>(dst)) T(*first); |  | 178 | 478 |             ++dst; |  | 179 | 478 |             ++first; |  | 180 | 478 |         } |  | 181 | 239 |     } | 
_ZN9prevectorILj35EhjiE4fillITkNSt3__114input_iteratorEPKhEEvPhT_S6_| Line | Count | Source |  | 175 | 239 |     void fill(T* dst, InputIterator first, InputIterator last) { |  | 176 | 478 |         while (first != last) { |  | 177 | 239 |             new(static_cast<void*>(dst)) T(*first); |  | 178 | 239 |             ++dst; |  | 179 | 239 |             ++first; |  | 180 | 239 |         } |  | 181 | 239 |     } | 
 | 
| 182 |  |  | 
| 183 |  | public: | 
| 184 | 63 |     void assign(size_type n, const T& val) { | 
| 185 | 63 |         clear(); | 
| 186 | 63 |         if (capacity() < n) { | 
| 187 | 0 |             change_capacity(n); | 
| 188 | 0 |         } | 
| 189 | 63 |         _size += n; | 
| 190 | 63 |         fill(item_ptr(0), n, val); | 
| 191 | 63 |     } _ZN9prevectorILj16EhjiE6assignEjRKh| Line | Count | Source |  | 184 | 63 |     void assign(size_type n, const T& val) { |  | 185 | 63 |         clear(); |  | 186 | 63 |         if (capacity() < n) { |  | 187 | 0 |             change_capacity(n); |  | 188 | 0 |         } |  | 189 | 63 |         _size += n; |  | 190 | 63 |         fill(item_ptr(0), n, val); |  | 191 | 63 |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE6assignEjRKi | 
| 192 |  |  | 
| 193 |  |     template <std::input_iterator InputIterator> | 
| 194 | 17.1M |     void assign(InputIterator first, InputIterator last) { | 
| 195 | 17.1M |         size_type n = last - first; | 
| 196 | 17.1M |         clear(); | 
| 197 | 17.1M |         if (capacity() < n) { | 
| 198 | 566k |             change_capacity(n); | 
| 199 | 566k |         } | 
| 200 | 17.1M |         _size += n; | 
| 201 | 17.1M |         fill(item_ptr(0), first, last); | 
| 202 | 17.1M |     } _ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorENS0_14const_iteratorEEEvT_S4_| Line | Count | Source |  | 194 | 381k |     void assign(InputIterator first, InputIterator last) { |  | 195 | 381k |         size_type n = last - first; |  | 196 | 381k |         clear(); |  | 197 | 381k |         if (capacity() < n) { |  | 198 | 2.67k |             change_capacity(n); |  | 199 | 2.67k |         } |  | 200 | 381k |         _size += n; |  | 201 | 381k |         fill(item_ptr(0), first, last); |  | 202 | 381k |     } | 
_ZN9prevectorILj36EhjiE6assignITkNSt3__114input_iteratorENS0_14const_iteratorEEEvT_S4_| Line | Count | Source |  | 194 | 16.6M |     void assign(InputIterator first, InputIterator last) { |  | 195 | 16.6M |         size_type n = last - first; |  | 196 | 16.6M |         clear(); |  | 197 | 16.6M |         if (capacity() < n) { |  | 198 | 564k |             change_capacity(n); |  | 199 | 564k |         } |  | 200 | 16.6M |         _size += n; |  | 201 | 16.6M |         fill(item_ptr(0), first, last); |  | 202 | 16.6M |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE6assignITkNSt3__114input_iteratorENS0_14const_iteratorEEEvT_S4_Unexecuted instantiation: _ZN9prevectorILj33EhjiE6assignITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvT_S7__ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvT_S7_| Line | Count | Source |  | 194 | 191k |     void assign(InputIterator first, InputIterator last) { |  | 195 | 191k |         size_type n = last - first; |  | 196 | 191k |         clear(); |  | 197 | 191k |         if (capacity() < n) { |  | 198 | 0 |             change_capacity(n); |  | 199 | 0 |         } |  | 200 | 191k |         _size += n; |  | 201 | 191k |         fill(item_ptr(0), first, last); |  | 202 | 191k |     } | 
_ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorEPhEEvT_S4_| Line | Count | Source |  | 194 | 2.34k |     void assign(InputIterator first, InputIterator last) { |  | 195 | 2.34k |         size_type n = last - first; |  | 196 | 2.34k |         clear(); |  | 197 | 2.34k |         if (capacity() < n) { |  | 198 | 0 |             change_capacity(n); |  | 199 | 0 |         } |  | 200 | 2.34k |         _size += n; |  | 201 | 2.34k |         fill(item_ptr(0), first, last); |  | 202 | 2.34k |     } | 
Unexecuted instantiation: _ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEEvT_S6_Unexecuted instantiation: _ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorEPKhEEvT_S5_ | 
| 203 |  |  | 
| 204 | 71.6M |     prevector() = default; _ZN9prevectorILj36EhjiEC2Ev| Line | Count | Source |  | 204 | 71.3M |     prevector() = default; | 
_ZN9prevectorILj33EhjiEC2Ev| Line | Count | Source |  | 204 | 324k |     prevector() = default; | 
Unexecuted instantiation: _ZN9prevectorILj8EijiEC2Ev | 
| 205 |  |  | 
| 206 |  |     explicit prevector(size_type n) { | 
| 207 |  |         resize(n); | 
| 208 |  |     } | 
| 209 |  |  | 
| 210 | 1.64M |     explicit prevector(size_type n, const T& val) { | 
| 211 | 1.64M |         change_capacity(n); | 
| 212 | 1.64M |         _size += n; | 
| 213 | 1.64M |         fill(item_ptr(0), n, val); | 
| 214 | 1.64M |     } Unexecuted instantiation: _ZN9prevectorILj33EhjiEC2EjRKh_ZN9prevectorILj16EhjiEC2EjRKh| Line | Count | Source |  | 210 | 1.64M |     explicit prevector(size_type n, const T& val) { |  | 211 | 1.64M |         change_capacity(n); |  | 212 | 1.64M |         _size += n; |  | 213 | 1.64M |         fill(item_ptr(0), n, val); |  | 214 | 1.64M |     } | 
 | 
| 215 |  |  | 
| 216 |  |     template <std::input_iterator InputIterator> | 
| 217 | 1.74M |     prevector(InputIterator first, InputIterator last) { | 
| 218 | 1.74M |         size_type n = last - first; | 
| 219 | 1.74M |         change_capacity(n); | 
| 220 | 1.74M |         _size += n; | 
| 221 | 1.74M |         fill(item_ptr(0), first, last); | 
| 222 | 1.74M |     } _ZN9prevectorILj36EhjiEC2ITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEET_S7_| Line | Count | Source |  | 217 | 1.74M |     prevector(InputIterator first, InputIterator last) { |  | 218 | 1.74M |         size_type n = last - first; |  | 219 | 1.74M |         change_capacity(n); |  | 220 | 1.74M |         _size += n; |  | 221 | 1.74M |         fill(item_ptr(0), first, last); |  | 222 | 1.74M |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiEC2ITkNSt3__114input_iteratorENS2_11__wrap_iterIPKiEEEET_S7_Unexecuted instantiation: _ZN9prevectorILj8EijiEC2ITkNSt3__114input_iteratorENS0_14const_iteratorEEET_S4_Unexecuted instantiation: _ZN9prevectorILj36EhjiEC2ITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEET_S6__ZN9prevectorILj35EhjiEC2ITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEET_S7_| Line | Count | Source |  | 217 | 239 |     prevector(InputIterator first, InputIterator last) { |  | 218 | 239 |         size_type n = last - first; |  | 219 | 239 |         change_capacity(n); |  | 220 | 239 |         _size += n; |  | 221 | 239 |         fill(item_ptr(0), first, last); |  | 222 | 239 |     } | 
Unexecuted instantiation: _ZN9prevectorILj36EhjiEC2ITkNSt3__114input_iteratorENS0_14const_iteratorEEET_S4_ | 
| 223 |  |  | 
| 224 | 75.1M |     prevector(const prevector<N, T, Size, Diff>& other) { | 
| 225 | 75.1M |         size_type n = other.size(); | 
| 226 | 75.1M |         change_capacity(n); | 
| 227 | 75.1M |         _size += n; | 
| 228 | 75.1M |         fill(item_ptr(0), other.begin(),  other.end()); | 
| 229 | 75.1M |     } _ZN9prevectorILj16EhjiEC2ERKS0_| Line | Count | Source |  | 224 | 2.50M |     prevector(const prevector<N, T, Size, Diff>& other) { |  | 225 | 2.50M |         size_type n = other.size(); |  | 226 | 2.50M |         change_capacity(n); |  | 227 | 2.50M |         _size += n; |  | 228 | 2.50M |         fill(item_ptr(0), other.begin(),  other.end()); |  | 229 | 2.50M |     } | 
_ZN9prevectorILj36EhjiEC2ERKS0_| Line | Count | Source |  | 224 | 72.6M |     prevector(const prevector<N, T, Size, Diff>& other) { |  | 225 | 72.6M |         size_type n = other.size(); |  | 226 | 72.6M |         change_capacity(n); |  | 227 | 72.6M |         _size += n; |  | 228 | 72.6M |         fill(item_ptr(0), other.begin(),  other.end()); |  | 229 | 72.6M |     } | 
 | 
| 230 |  |  | 
| 231 |  |     prevector(prevector<N, T, Size, Diff>&& other) noexcept | 
| 232 | 14.7M |         : _union(std::move(other._union)), _size(other._size) | 
| 233 | 14.7M |     { | 
| 234 | 14.7M |         other._size = 0; | 
| 235 | 14.7M |     } _ZN9prevectorILj16EhjiEC2EOS0_| Line | Count | Source |  | 232 | 2.02k |         : _union(std::move(other._union)), _size(other._size) |  | 233 | 2.02k |     { |  | 234 | 2.02k |         other._size = 0; |  | 235 | 2.02k |     } | 
_ZN9prevectorILj36EhjiEC2EOS0_| Line | Count | Source |  | 232 | 14.7M |         : _union(std::move(other._union)), _size(other._size) |  | 233 | 14.7M |     { |  | 234 | 14.7M |         other._size = 0; |  | 235 | 14.7M |     } | 
 | 
| 236 |  |  | 
| 237 | 16.9M |     prevector& operator=(const prevector<N, T, Size, Diff>& other) { | 
| 238 | 16.9M |         if (&other == this) { | 
| 239 | 0 |             return *this; | 
| 240 | 0 |         } | 
| 241 | 16.9M |         assign(other.begin(), other.end()); | 
| 242 | 16.9M |         return *this; | 
| 243 | 16.9M |     } _ZN9prevectorILj16EhjiEaSERKS0_| Line | Count | Source |  | 237 | 381k |     prevector& operator=(const prevector<N, T, Size, Diff>& other) { |  | 238 | 381k |         if (&other == this) { |  | 239 | 0 |             return *this; |  | 240 | 0 |         } |  | 241 | 381k |         assign(other.begin(), other.end()); |  | 242 | 381k |         return *this; |  | 243 | 381k |     } | 
_ZN9prevectorILj36EhjiEaSERKS0_| Line | Count | Source |  | 237 | 16.6M |     prevector& operator=(const prevector<N, T, Size, Diff>& other) { |  | 238 | 16.6M |         if (&other == this) { |  | 239 | 0 |             return *this; |  | 240 | 0 |         } |  | 241 | 16.6M |         assign(other.begin(), other.end()); |  | 242 | 16.6M |         return *this; |  | 243 | 16.6M |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiEaSERKS0_ | 
| 244 |  |  | 
| 245 | 26.3M |     prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { | 
| 246 | 26.3M |         if (!is_direct()) { | 
| 247 | 0 |             free(_union.indirect_contents.indirect); | 
| 248 | 0 |         } | 
| 249 | 26.3M |         _union = std::move(other._union); | 
| 250 | 26.3M |         _size = other._size; | 
| 251 | 26.3M |         other._size = 0; | 
| 252 | 26.3M |         return *this; | 
| 253 | 26.3M |     } Unexecuted instantiation: _ZN9prevectorILj16EhjiEaSEOS0__ZN9prevectorILj36EhjiEaSEOS0_| Line | Count | Source |  | 245 | 26.3M |     prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept { |  | 246 | 26.3M |         if (!is_direct()) { |  | 247 | 0 |             free(_union.indirect_contents.indirect); |  | 248 | 0 |         } |  | 249 | 26.3M |         _union = std::move(other._union); |  | 250 | 26.3M |         _size = other._size; |  | 251 | 26.3M |         other._size = 0; |  | 252 | 26.3M |         return *this; |  | 253 | 26.3M |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiEaSEOS0_ | 
| 254 |  |  | 
| 255 | 747M |     size_type size() const { | 
| 256 | 747M |         return is_direct() ? _size691M: _size - N - 155.6M; | 
| 257 | 747M |     } _ZNK9prevectorILj36EhjiE4sizeEv| Line | Count | Source |  | 255 | 732M |     size_type size() const { |  | 256 | 732M |         return is_direct() ? _size677M: _size - N - 155.1M; |  | 257 | 732M |     } | 
Unexecuted instantiation: _ZNK9prevectorILj33EhjiE4sizeEv_ZNK9prevectorILj16EhjiE4sizeEv| Line | Count | Source |  | 255 | 14.9M |     size_type size() const { |  | 256 | 14.9M |         return is_direct() ? _size14.4M: _size - N - 1506k; |  | 257 | 14.9M |     } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE4sizeEv_ZNK9prevectorILj35EhjiE4sizeEv| Line | Count | Source |  | 255 | 1.67k |     size_type size() const { |  | 256 | 1.67k |         return is_direct() ? _size : _size - N - 10; |  | 257 | 1.67k |     } | 
 | 
| 258 |  |  | 
| 259 | 98.0M |     bool empty() const { | 
| 260 | 98.0M |         return size() == 0; | 
| 261 | 98.0M |     } _ZNK9prevectorILj36EhjiE5emptyEv| Line | Count | Source |  | 259 | 98.0M |     bool empty() const { |  | 260 | 98.0M |         return size() == 0; |  | 261 | 98.0M |     } | 
Unexecuted instantiation: _ZNK9prevectorILj16EhjiE5emptyEvUnexecuted instantiation: _ZNK9prevectorILj8EijiE5emptyEv | 
| 262 |  |  | 
| 263 | 12.9M |     iterator begin() { return iterator(item_ptr(0)); }Unexecuted instantiation: _ZN9prevectorILj33EhjiE5beginEv_ZN9prevectorILj36EhjiE5beginEv| Line | Count | Source |  | 263 | 12.9M |     iterator begin() { return iterator(item_ptr(0)); } | 
Unexecuted instantiation: _ZN9prevectorILj16EhjiE5beginEvUnexecuted instantiation: _ZN9prevectorILj8EijiE5beginEv_ZN9prevectorILj35EhjiE5beginEv| Line | Count | Source |  | 263 | 478 |     iterator begin() { return iterator(item_ptr(0)); } | 
 | 
| 264 | 132M |     const_iterator begin() const { return const_iterator(item_ptr(0)); }_ZNK9prevectorILj36EhjiE5beginEv| Line | Count | Source |  | 264 | 127M |     const_iterator begin() const { return const_iterator(item_ptr(0)); } | 
_ZNK9prevectorILj16EhjiE5beginEv| Line | Count | Source |  | 264 | 4.94M |     const_iterator begin() const { return const_iterator(item_ptr(0)); } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE5beginEv | 
| 265 | 26.9M |     iterator end() { return iterator(item_ptr(size())); }_ZN9prevectorILj36EhjiE3endEv| Line | Count | Source |  | 265 | 25.1M |     iterator end() { return iterator(item_ptr(size())); } | 
Unexecuted instantiation: _ZN9prevectorILj33EhjiE3endEv_ZN9prevectorILj16EhjiE3endEv| Line | Count | Source |  | 265 | 1.75M |     iterator end() { return iterator(item_ptr(size())); } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE3endEv_ZN9prevectorILj35EhjiE3endEv| Line | Count | Source |  | 265 | 478 |     iterator end() { return iterator(item_ptr(size())); } | 
 | 
| 266 | 121M |     const_iterator end() const { return const_iterator(item_ptr(size())); }_ZNK9prevectorILj36EhjiE3endEv| Line | Count | Source |  | 266 | 119M |     const_iterator end() const { return const_iterator(item_ptr(size())); } | 
_ZNK9prevectorILj16EhjiE3endEv| Line | Count | Source |  | 266 | 2.95M |     const_iterator end() const { return const_iterator(item_ptr(size())); } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE3endEv | 
| 267 |  |  | 
| 268 | 40.0M |     size_t capacity() const { | 
| 269 | 40.0M |         if (is_direct()) { | 
| 270 | 39.8M |             return N; | 
| 271 | 39.8M |         } else { | 
| 272 | 256k |             return _union.indirect_contents.capacity; | 
| 273 | 256k |         } | 
| 274 | 40.0M |     } _ZNK9prevectorILj36EhjiE8capacityEv| Line | Count | Source |  | 268 | 39.4M |     size_t capacity() const { |  | 269 | 39.4M |         if (is_direct()) { |  | 270 | 39.2M |             return N; |  | 271 | 39.2M |         } else { |  | 272 | 256k |             return _union.indirect_contents.capacity; |  | 273 | 256k |         } |  | 274 | 39.4M |     } | 
_ZNK9prevectorILj16EhjiE8capacityEv| Line | Count | Source |  | 268 | 638k |     size_t capacity() const { |  | 269 | 638k |         if (is_direct()) { |  | 270 | 638k |             return N; |  | 271 | 638k |         } else { |  | 272 | 0 |             return _union.indirect_contents.capacity; |  | 273 | 0 |         } |  | 274 | 638k |     } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiE8capacityEvUnexecuted instantiation: _ZNK9prevectorILj33EhjiE8capacityEv_ZNK9prevectorILj35EhjiE8capacityEv| Line | Count | Source |  | 268 | 478 |     size_t capacity() const { |  | 269 | 478 |         if (is_direct()) { |  | 270 | 478 |             return N; |  | 271 | 478 |         } else { |  | 272 | 0 |             return _union.indirect_contents.capacity; |  | 273 | 0 |         } |  | 274 | 478 |     } | 
 | 
| 275 |  |  | 
| 276 | 23.1M |     T& operator[](size_type pos) { | 
| 277 | 23.1M |         return *item_ptr(pos); | 
| 278 | 23.1M |     } _ZN9prevectorILj36EhjiEixEj| Line | Count | Source |  | 276 | 23.1M |     T& operator[](size_type pos) { |  | 277 | 23.1M |         return *item_ptr(pos); |  | 278 | 23.1M |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiEixEjUnexecuted instantiation: _ZN9prevectorILj33EhjiEixEjUnexecuted instantiation: _ZN9prevectorILj16EhjiEixEj | 
| 279 |  |  | 
| 280 | 33.6M |     const T& operator[](size_type pos) const { | 
| 281 | 33.6M |         return *item_ptr(pos); | 
| 282 | 33.6M |     } _ZNK9prevectorILj36EhjiEixEj| Line | Count | Source |  | 280 | 28.9M |     const T& operator[](size_type pos) const { |  | 281 | 28.9M |         return *item_ptr(pos); |  | 282 | 28.9M |     } | 
_ZNK9prevectorILj16EhjiEixEj| Line | Count | Source |  | 280 | 4.69M |     const T& operator[](size_type pos) const { |  | 281 | 4.69M |         return *item_ptr(pos); |  | 282 | 4.69M |     } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiEixEj | 
| 283 |  |  | 
| 284 | 79.7M |     void resize(size_type new_size) { | 
| 285 | 79.7M |         size_type cur_size = size(); | 
| 286 | 79.7M |         if (cur_size == new_size) { | 
| 287 | 69.3M |             return; | 
| 288 | 69.3M |         } | 
| 289 | 10.4M |         if (cur_size > new_size) { | 
| 290 | 6.99M |             erase(item_ptr(new_size), end()); | 
| 291 | 6.99M |             return; | 
| 292 | 6.99M |         } | 
| 293 | 3.40M |         if (new_size > capacity()) { | 
| 294 | 2.06M |             change_capacity(new_size); | 
| 295 | 2.06M |         } | 
| 296 | 3.40M |         ptrdiff_t increase = new_size - cur_size; | 
| 297 | 3.40M |         fill(item_ptr(cur_size), increase); | 
| 298 | 3.40M |         _size += increase; | 
| 299 | 3.40M |     } _ZN9prevectorILj36EhjiE6resizeEj| Line | Count | Source |  | 284 | 78.7M |     void resize(size_type new_size) { |  | 285 | 78.7M |         size_type cur_size = size(); |  | 286 | 78.7M |         if (cur_size == new_size) { |  | 287 | 69.2M |             return; |  | 288 | 69.2M |         } |  | 289 | 9.46M |         if (cur_size > new_size) { |  | 290 | 6.11M |             erase(item_ptr(new_size), end()); |  | 291 | 6.11M |             return; |  | 292 | 6.11M |         } |  | 293 | 3.34M |         if (new_size > capacity()) { |  | 294 | 2.00M |             change_capacity(new_size); |  | 295 | 2.00M |         } |  | 296 | 3.34M |         ptrdiff_t increase = new_size - cur_size; |  | 297 | 3.34M |         fill(item_ptr(cur_size), increase); |  | 298 | 3.34M |         _size += increase; |  | 299 | 3.34M |     } | 
_ZN9prevectorILj16EhjiE6resizeEj| Line | Count | Source |  | 284 | 958k |     void resize(size_type new_size) { |  | 285 | 958k |         size_type cur_size = size(); |  | 286 | 958k |         if (cur_size == new_size) { |  | 287 | 17.0k |             return; |  | 288 | 17.0k |         } |  | 289 | 941k |         if (cur_size > new_size) { |  | 290 | 878k |             erase(item_ptr(new_size), end()); |  | 291 | 878k |             return; |  | 292 | 878k |         } |  | 293 | 62.5k |         if (new_size > capacity()) { |  | 294 | 62.5k |             change_capacity(new_size); |  | 295 | 62.5k |         } |  | 296 | 62.5k |         ptrdiff_t increase = new_size - cur_size; |  | 297 | 62.5k |         fill(item_ptr(cur_size), increase); |  | 298 | 62.5k |         _size += increase; |  | 299 | 62.5k |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE6resizeEjUnexecuted instantiation: _ZN9prevectorILj33EhjiE6resizeEj | 
| 300 |  |  | 
| 301 | 0 |     void reserve(size_type new_capacity) { | 
| 302 | 0 |         if (new_capacity > capacity()) { | 
| 303 | 0 |             change_capacity(new_capacity); | 
| 304 | 0 |         } | 
| 305 | 0 |     } Unexecuted instantiation: _ZN9prevectorILj36EhjiE7reserveEjUnexecuted instantiation: _ZN9prevectorILj8EijiE7reserveEj | 
| 306 |  |  | 
| 307 | 46.5M |     void shrink_to_fit() { | 
| 308 | 46.5M |         change_capacity(size()); | 
| 309 | 46.5M |     } _ZN9prevectorILj36EhjiE13shrink_to_fitEv| Line | Count | Source |  | 307 | 46.5M |     void shrink_to_fit() { |  | 308 | 46.5M |         change_capacity(size()); |  | 309 | 46.5M |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE13shrink_to_fitEv | 
| 310 |  |  | 
| 311 | 75.9M |     void clear() { | 
| 312 | 75.9M |         resize(0); | 
| 313 | 75.9M |     } _ZN9prevectorILj36EhjiE5clearEv| Line | Count | Source |  | 311 | 75.4M |     void clear() { |  | 312 | 75.4M |         resize(0); |  | 313 | 75.4M |     } | 
_ZN9prevectorILj16EhjiE5clearEv| Line | Count | Source |  | 311 | 575k |     void clear() { |  | 312 | 575k |         resize(0); |  | 313 | 575k |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE5clearEvUnexecuted instantiation: _ZN9prevectorILj33EhjiE5clearEv | 
| 314 |  |  | 
| 315 | 7.63M |     iterator insert(iterator pos, const T& value) { | 
| 316 | 7.63M |         size_type p = pos - begin(); | 
| 317 | 7.63M |         size_type new_size = size() + 1; | 
| 318 | 7.63M |         if (capacity() < new_size) { | 
| 319 | 0 |             change_capacity(new_size + (new_size >> 1)); | 
| 320 | 0 |         } | 
| 321 | 7.63M |         T* ptr = item_ptr(p); | 
| 322 | 7.63M |         T* dst = ptr + 1; | 
| 323 | 7.63M |         memmove(dst, ptr, (size() - p) * sizeof(T)); | 
| 324 | 7.63M |         _size++; | 
| 325 | 7.63M |         new(static_cast<void*>(ptr)) T(value); | 
| 326 | 7.63M |         return iterator(ptr); | 
| 327 | 7.63M |     } _ZN9prevectorILj36EhjiE6insertENS0_8iteratorERKh| Line | Count | Source |  | 315 | 7.63M |     iterator insert(iterator pos, const T& value) { |  | 316 | 7.63M |         size_type p = pos - begin(); |  | 317 | 7.63M |         size_type new_size = size() + 1; |  | 318 | 7.63M |         if (capacity() < new_size) { |  | 319 | 0 |             change_capacity(new_size + (new_size >> 1)); |  | 320 | 0 |         } |  | 321 | 7.63M |         T* ptr = item_ptr(p); |  | 322 | 7.63M |         T* dst = ptr + 1; |  | 323 | 7.63M |         memmove(dst, ptr, (size() - p) * sizeof(T)); |  | 324 | 7.63M |         _size++; |  | 325 | 7.63M |         new(static_cast<void*>(ptr)) T(value); |  | 326 | 7.63M |         return iterator(ptr); |  | 327 | 7.63M |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE6insertENS0_8iteratorERKi | 
| 328 |  |  | 
| 329 | 0 |     void insert(iterator pos, size_type count, const T& value) { | 
| 330 | 0 |         size_type p = pos - begin(); | 
| 331 | 0 |         size_type new_size = size() + count; | 
| 332 | 0 |         if (capacity() < new_size) { | 
| 333 | 0 |             change_capacity(new_size + (new_size >> 1)); | 
| 334 | 0 |         } | 
| 335 | 0 |         T* ptr = item_ptr(p); | 
| 336 | 0 |         T* dst = ptr + count; | 
| 337 | 0 |         memmove(dst, ptr, (size() - p) * sizeof(T)); | 
| 338 | 0 |         _size += count; | 
| 339 | 0 |         fill(item_ptr(p), count, value); | 
| 340 | 0 |     } Unexecuted instantiation: _ZN9prevectorILj8EijiE6insertENS0_8iteratorEjRKiUnexecuted instantiation: _ZN9prevectorILj36EhjiE6insertENS0_8iteratorEjRKh | 
| 341 |  |  | 
| 342 |  |     template <std::input_iterator InputIterator> | 
| 343 | 3.26M |     void insert(iterator pos, InputIterator first, InputIterator last) { | 
| 344 | 3.26M |         size_type p = pos - begin(); | 
| 345 | 3.26M |         difference_type count = last - first; | 
| 346 | 3.26M |         size_type new_size = size() + count; | 
| 347 | 3.26M |         if (capacity() < new_size) { | 
| 348 | 564k |             change_capacity(new_size + (new_size >> 1)); | 
| 349 | 564k |         } | 
| 350 | 3.26M |         T* ptr = item_ptr(p); | 
| 351 | 3.26M |         T* dst = ptr + count; | 
| 352 | 3.26M |         memmove(dst, ptr, (size() - p) * sizeof(T)); | 
| 353 | 3.26M |         _size += count; | 
| 354 | 3.26M |         fill(ptr, first, last); | 
| 355 | 3.26M |     } Unexecuted instantiation: _ZN9prevectorILj36EhjiE6insertITkNSt3__114input_iteratorEPKhEEvNS0_8iteratorET_S6__ZN9prevectorILj36EhjiE6insertITkNSt3__114input_iteratorENS2_11__wrap_iterIPKhEEEEvNS0_8iteratorET_S8_| Line | Count | Source |  | 343 | 3.26M |     void insert(iterator pos, InputIterator first, InputIterator last) { |  | 344 | 3.26M |         size_type p = pos - begin(); |  | 345 | 3.26M |         difference_type count = last - first; |  | 346 | 3.26M |         size_type new_size = size() + count; |  | 347 | 3.26M |         if (capacity() < new_size) { |  | 348 | 564k |             change_capacity(new_size + (new_size >> 1)); |  | 349 | 564k |         } |  | 350 | 3.26M |         T* ptr = item_ptr(p); |  | 351 | 3.26M |         T* dst = ptr + count; |  | 352 | 3.26M |         memmove(dst, ptr, (size() - p) * sizeof(T)); |  | 353 | 3.26M |         _size += count; |  | 354 | 3.26M |         fill(ptr, first, last); |  | 355 | 3.26M |     } | 
Unexecuted instantiation: _ZN9prevectorILj36EhjiE6insertITkNSt3__114input_iteratorENS0_8iteratorEEEvS3_T_S4_Unexecuted instantiation: _ZN9prevectorILj8EijiE6insertITkNSt3__114input_iteratorEPiEEvNS0_8iteratorET_S5_Unexecuted instantiation: _ZN9prevectorILj36EhjiE6insertITkNSt3__114input_iteratorENS2_11__wrap_iterIPhEEEEvNS0_8iteratorET_S7__ZN9prevectorILj35EhjiE6insertITkNSt3__114input_iteratorEPhEEvNS0_8iteratorET_S5_| Line | Count | Source |  | 343 | 239 |     void insert(iterator pos, InputIterator first, InputIterator last) { |  | 344 | 239 |         size_type p = pos - begin(); |  | 345 | 239 |         difference_type count = last - first; |  | 346 | 239 |         size_type new_size = size() + count; |  | 347 | 239 |         if (capacity() < new_size) { |  | 348 | 0 |             change_capacity(new_size + (new_size >> 1)); |  | 349 | 0 |         } |  | 350 | 239 |         T* ptr = item_ptr(p); |  | 351 | 239 |         T* dst = ptr + count; |  | 352 | 239 |         memmove(dst, ptr, (size() - p) * sizeof(T)); |  | 353 | 239 |         _size += count; |  | 354 | 239 |         fill(ptr, first, last); |  | 355 | 239 |     } | 
_ZN9prevectorILj35EhjiE6insertITkNSt3__114input_iteratorEPKhEEvNS0_8iteratorET_S6_| Line | Count | Source |  | 343 | 239 |     void insert(iterator pos, InputIterator first, InputIterator last) { |  | 344 | 239 |         size_type p = pos - begin(); |  | 345 | 239 |         difference_type count = last - first; |  | 346 | 239 |         size_type new_size = size() + count; |  | 347 | 239 |         if (capacity() < new_size) { |  | 348 | 0 |             change_capacity(new_size + (new_size >> 1)); |  | 349 | 0 |         } |  | 350 | 239 |         T* ptr = item_ptr(p); |  | 351 | 239 |         T* dst = ptr + count; |  | 352 | 239 |         memmove(dst, ptr, (size() - p) * sizeof(T)); |  | 353 | 239 |         _size += count; |  | 354 | 239 |         fill(ptr, first, last); |  | 355 | 239 |     } | 
Unexecuted instantiation: _ZN9prevectorILj36EhjiE6insertITkNSt3__114input_iteratorENS0_14const_iteratorEEEvNS0_8iteratorET_S5_ | 
| 356 |  |  | 
| 357 | 8.60M |     inline void resize_uninitialized(size_type new_size) { | 
| 358 |  |         // resize_uninitialized changes the size of the prevector but does not initialize it. | 
| 359 |  |         // If size < new_size, the added elements must be initialized explicitly. | 
| 360 | 8.60M |         if (capacity() < new_size) { | 
| 361 | 1.66M |             change_capacity(new_size); | 
| 362 | 1.66M |             _size += new_size - size(); | 
| 363 | 1.66M |             return; | 
| 364 | 1.66M |         } | 
| 365 | 6.94M |         if (new_size < size()) { | 
| 366 | 0 |             erase(item_ptr(new_size), end()); | 
| 367 | 6.94M |         } else { | 
| 368 | 6.94M |             _size += new_size - size(); | 
| 369 | 6.94M |         } | 
| 370 | 6.94M |     } _ZN9prevectorILj36EhjiE20resize_uninitializedEj| Line | Count | Source |  | 357 | 8.60M |     inline void resize_uninitialized(size_type new_size) { |  | 358 |  |         // resize_uninitialized changes the size of the prevector but does not initialize it. |  | 359 |  |         // If size < new_size, the added elements must be initialized explicitly. |  | 360 | 8.60M |         if (capacity() < new_size) { |  | 361 | 1.66M |             change_capacity(new_size); |  | 362 | 1.66M |             _size += new_size - size(); |  | 363 | 1.66M |             return; |  | 364 | 1.66M |         } |  | 365 | 6.94M |         if (new_size < size()) { |  | 366 | 0 |             erase(item_ptr(new_size), end()); |  | 367 | 6.94M |         } else { |  | 368 | 6.94M |             _size += new_size - size(); |  | 369 | 6.94M |         } |  | 370 | 6.94M |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE20resize_uninitializedEj | 
| 371 |  |  | 
| 372 | 0 |     iterator erase(iterator pos) { | 
| 373 | 0 |         return erase(pos, pos + 1); | 
| 374 | 0 |     } Unexecuted instantiation: _ZN9prevectorILj8EijiE5eraseENS0_8iteratorEUnexecuted instantiation: _ZN9prevectorILj33EhjiE5eraseENS0_8iteratorE | 
| 375 |  |  | 
| 376 | 6.99M |     iterator erase(iterator first, iterator last) { | 
| 377 |  |         // Erase is not allowed to the change the object's capacity. That means | 
| 378 |  |         // that when starting with an indirectly allocated prevector with | 
| 379 |  |         // size and capacity > N, the result may be a still indirectly allocated | 
| 380 |  |         // prevector with size <= N and capacity > N. A shrink_to_fit() call is | 
| 381 |  |         // necessary to switch to the (more efficient) directly allocated | 
| 382 |  |         // representation (with capacity N and size <= N). | 
| 383 | 6.99M |         iterator p = first; | 
| 384 | 6.99M |         char* endp = (char*)&(*end()); | 
| 385 | 6.99M |         _size -= last - p; | 
| 386 | 6.99M |         memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); | 
| 387 | 6.99M |         return first; | 
| 388 | 6.99M |     } _ZN9prevectorILj36EhjiE5eraseENS0_8iteratorES1_| Line | Count | Source |  | 376 | 6.11M |     iterator erase(iterator first, iterator last) { |  | 377 |  |         // Erase is not allowed to the change the object's capacity. That means |  | 378 |  |         // that when starting with an indirectly allocated prevector with |  | 379 |  |         // size and capacity > N, the result may be a still indirectly allocated |  | 380 |  |         // prevector with size <= N and capacity > N. A shrink_to_fit() call is |  | 381 |  |         // necessary to switch to the (more efficient) directly allocated |  | 382 |  |         // representation (with capacity N and size <= N). |  | 383 | 6.11M |         iterator p = first; |  | 384 | 6.11M |         char* endp = (char*)&(*end()); |  | 385 | 6.11M |         _size -= last - p; |  | 386 | 6.11M |         memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); |  | 387 | 6.11M |         return first; |  | 388 | 6.11M |     } | 
_ZN9prevectorILj16EhjiE5eraseENS0_8iteratorES1_| Line | Count | Source |  | 376 | 878k |     iterator erase(iterator first, iterator last) { |  | 377 |  |         // Erase is not allowed to the change the object's capacity. That means |  | 378 |  |         // that when starting with an indirectly allocated prevector with |  | 379 |  |         // size and capacity > N, the result may be a still indirectly allocated |  | 380 |  |         // prevector with size <= N and capacity > N. A shrink_to_fit() call is |  | 381 |  |         // necessary to switch to the (more efficient) directly allocated |  | 382 |  |         // representation (with capacity N and size <= N). |  | 383 | 878k |         iterator p = first; |  | 384 | 878k |         char* endp = (char*)&(*end()); |  | 385 | 878k |         _size -= last - p; |  | 386 | 878k |         memmove(&(*first), &(*last), endp - ((char*)(&(*last)))); |  | 387 | 878k |         return first; |  | 388 | 878k |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiE5eraseENS0_8iteratorES1_Unexecuted instantiation: _ZN9prevectorILj33EhjiE5eraseENS0_8iteratorES1_ | 
| 389 |  |  | 
| 390 |  |     template<typename... Args> | 
| 391 | 0 |     void emplace_back(Args&&... args) { | 
| 392 | 0 |         size_type new_size = size() + 1; | 
| 393 | 0 |         if (capacity() < new_size) { | 
| 394 | 0 |             change_capacity(new_size + (new_size >> 1)); | 
| 395 | 0 |         } | 
| 396 | 0 |         new(item_ptr(size())) T(std::forward<Args>(args)...); | 
| 397 | 0 |         _size++; | 
| 398 | 0 |     } Unexecuted instantiation: _ZN9prevectorILj36EhjiE12emplace_backIJRKhEEEvDpOT_Unexecuted instantiation: _ZN9prevectorILj8EijiE12emplace_backIJRKiEEEvDpOT_ | 
| 399 |  |  | 
| 400 | 0 |     void push_back(const T& value) { | 
| 401 | 0 |         emplace_back(value); | 
| 402 | 0 |     } Unexecuted instantiation: _ZN9prevectorILj36EhjiE9push_backERKhUnexecuted instantiation: _ZN9prevectorILj8EijiE9push_backERKi | 
| 403 |  |  | 
| 404 | 0 |     void pop_back() { | 
| 405 | 0 |         erase(end() - 1, end()); | 
| 406 | 0 |     } | 
| 407 |  |  | 
| 408 |  |     T& front() { | 
| 409 |  |         return *item_ptr(0); | 
| 410 |  |     } | 
| 411 |  |  | 
| 412 |  |     const T& front() const { | 
| 413 |  |         return *item_ptr(0); | 
| 414 |  |     } | 
| 415 |  |  | 
| 416 | 0 |     T& back() { | 
| 417 | 0 |         return *item_ptr(size() - 1); | 
| 418 | 0 |     } | 
| 419 |  |  | 
| 420 | 0 |     const T& back() const { | 
| 421 | 0 |         return *item_ptr(size() - 1); | 
| 422 | 0 |     } | 
| 423 |  |  | 
| 424 |  |     void swap(prevector<N, T, Size, Diff>& other) noexcept | 
| 425 | 0 |     { | 
| 426 | 0 |         std::swap(_union, other._union); | 
| 427 | 0 |         std::swap(_size, other._size); | 
| 428 | 0 |     } | 
| 429 |  |  | 
| 430 | 164M |     ~prevector() { | 
| 431 | 164M |         if (!is_direct()) { | 
| 432 | 9.36M |             free(_union.indirect_contents.indirect); | 
| 433 | 9.36M |             _union.indirect_contents.indirect = nullptr; | 
| 434 | 9.36M |         } | 
| 435 | 164M |     } _ZN9prevectorILj16EhjiED2Ev| Line | Count | Source |  | 430 | 4.15M |     ~prevector() { |  | 431 | 4.15M |         if (!is_direct()) { |  | 432 | 278k |             free(_union.indirect_contents.indirect); |  | 433 | 278k |             _union.indirect_contents.indirect = nullptr; |  | 434 | 278k |         } |  | 435 | 4.15M |     } | 
_ZN9prevectorILj36EhjiED2Ev| Line | Count | Source |  | 430 | 160M |     ~prevector() { |  | 431 | 160M |         if (!is_direct()) { |  | 432 | 9.08M |             free(_union.indirect_contents.indirect); |  | 433 | 9.08M |             _union.indirect_contents.indirect = nullptr; |  | 434 | 9.08M |         } |  | 435 | 160M |     } | 
_ZN9prevectorILj33EhjiED2Ev| Line | Count | Source |  | 430 | 324k |     ~prevector() { |  | 431 | 324k |         if (!is_direct()) { |  | 432 | 0 |             free(_union.indirect_contents.indirect); |  | 433 | 0 |             _union.indirect_contents.indirect = nullptr; |  | 434 | 0 |         } |  | 435 | 324k |     } | 
Unexecuted instantiation: _ZN9prevectorILj8EijiED2Ev_ZN9prevectorILj35EhjiED2Ev| Line | Count | Source |  | 430 | 239 |     ~prevector() { |  | 431 | 239 |         if (!is_direct()) { |  | 432 | 0 |             free(_union.indirect_contents.indirect); |  | 433 | 0 |             _union.indirect_contents.indirect = nullptr; |  | 434 | 0 |         } |  | 435 | 239 |     } | 
 | 
| 436 |  |  | 
| 437 | 861k |     bool operator==(const prevector<N, T, Size, Diff>& other) const { | 
| 438 | 861k |         if (other.size() != size()) { | 
| 439 | 0 |             return false; | 
| 440 | 0 |         } | 
| 441 | 861k |         const_iterator b1 = begin(); | 
| 442 | 861k |         const_iterator b2 = other.begin(); | 
| 443 | 861k |         const_iterator e1 = end(); | 
| 444 | 28.3M |         while (b1 != e1) { | 
| 445 | 27.5M |             if ((*b1) != (*b2)) { | 
| 446 | 57.4k |                 return false; | 
| 447 | 57.4k |             } | 
| 448 | 27.4M |             ++b1; | 
| 449 | 27.4M |             ++b2; | 
| 450 | 27.4M |         } | 
| 451 | 804k |         return true; | 
| 452 | 861k |     } _ZNK9prevectorILj36EhjiEeqERKS0_| Line | Count | Source |  | 437 | 801k |     bool operator==(const prevector<N, T, Size, Diff>& other) const { |  | 438 | 801k |         if (other.size() != size()) { |  | 439 | 0 |             return false; |  | 440 | 0 |         } |  | 441 | 801k |         const_iterator b1 = begin(); |  | 442 | 801k |         const_iterator b2 = other.begin(); |  | 443 | 801k |         const_iterator e1 = end(); |  | 444 | 28.0M |         while (b1 != e1) { |  | 445 | 27.2M |             if ((*b1) != (*b2)) { |  | 446 | 0 |                 return false; |  | 447 | 0 |             } |  | 448 | 27.2M |             ++b1; |  | 449 | 27.2M |             ++b2; |  | 450 | 27.2M |         } |  | 451 | 801k |         return true; |  | 452 | 801k |     } | 
Unexecuted instantiation: _ZNK9prevectorILj8EijiEeqERKS0__ZNK9prevectorILj16EhjiEeqERKS0_| Line | Count | Source |  | 437 | 60.2k |     bool operator==(const prevector<N, T, Size, Diff>& other) const { |  | 438 | 60.2k |         if (other.size() != size()) { |  | 439 | 0 |             return false; |  | 440 | 0 |         } |  | 441 | 60.2k |         const_iterator b1 = begin(); |  | 442 | 60.2k |         const_iterator b2 = other.begin(); |  | 443 | 60.2k |         const_iterator e1 = end(); |  | 444 | 269k |         while (b1 != e1) { |  | 445 | 266k |             if ((*b1) != (*b2)) { |  | 446 | 57.4k |                 return false; |  | 447 | 57.4k |             } |  | 448 | 208k |             ++b1; |  | 449 | 208k |             ++b2; |  | 450 | 208k |         } |  | 451 | 2.74k |         return true; |  | 452 | 60.2k |     } | 
 | 
| 453 |  |  | 
| 454 | 0 |     bool operator!=(const prevector<N, T, Size, Diff>& other) const { | 
| 455 | 0 |         return !(*this == other); | 
| 456 | 0 |     } | 
| 457 |  |  | 
| 458 | 0 |     bool operator<(const prevector<N, T, Size, Diff>& other) const { | 
| 459 | 0 |         if (size() < other.size()) { | 
| 460 | 0 |             return true; | 
| 461 | 0 |         } | 
| 462 | 0 |         if (size() > other.size()) { | 
| 463 | 0 |             return false; | 
| 464 | 0 |         } | 
| 465 | 0 |         const_iterator b1 = begin(); | 
| 466 | 0 |         const_iterator b2 = other.begin(); | 
| 467 | 0 |         const_iterator e1 = end(); | 
| 468 | 0 |         while (b1 != e1) { | 
| 469 | 0 |             if ((*b1) < (*b2)) { | 
| 470 | 0 |                 return true; | 
| 471 | 0 |             } | 
| 472 | 0 |             if ((*b2) < (*b1)) { | 
| 473 | 0 |                 return false; | 
| 474 | 0 |             } | 
| 475 | 0 |             ++b1; | 
| 476 | 0 |             ++b2; | 
| 477 | 0 |         } | 
| 478 | 0 |         return false; | 
| 479 | 0 |     } Unexecuted instantiation: _ZNK9prevectorILj36EhjiEltERKS0_Unexecuted instantiation: _ZNK9prevectorILj16EhjiEltERKS0_ | 
| 480 |  |  | 
| 481 | 43.9M |     size_t allocated_memory() const { | 
| 482 | 43.9M |         if (is_direct()) { | 
| 483 | 43.9M |             return 0; | 
| 484 | 43.9M |         } else { | 
| 485 | 78 |             return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity; | 
| 486 | 78 |         } | 
| 487 | 43.9M |     } | 
| 488 |  |  | 
| 489 | 2.72M |     value_type* data() { | 
| 490 | 2.72M |         return item_ptr(0); | 
| 491 | 2.72M |     } Unexecuted instantiation: _ZN9prevectorILj33EhjiE4dataEv_ZN9prevectorILj36EhjiE4dataEv| Line | Count | Source |  | 489 | 2.33M |     value_type* data() { |  | 490 | 2.33M |         return item_ptr(0); |  | 491 | 2.33M |     } | 
_ZN9prevectorILj16EhjiE4dataEv| Line | Count | Source |  | 489 | 382k |     value_type* data() { |  | 490 | 382k |         return item_ptr(0); |  | 491 | 382k |     } | 
_ZN9prevectorILj35EhjiE4dataEv| Line | Count | Source |  | 489 | 239 |     value_type* data() { |  | 490 | 239 |         return item_ptr(0); |  | 491 | 239 |     } | 
 | 
| 492 |  |  | 
| 493 | 73.1M |     const value_type* data() const { | 
| 494 | 73.1M |         return item_ptr(0); | 
| 495 | 73.1M |     } _ZNK9prevectorILj36EhjiE4dataEv| Line | Count | Source |  | 493 | 70.4M |     const value_type* data() const { |  | 494 | 70.4M |         return item_ptr(0); |  | 495 | 70.4M |     } | 
_ZNK9prevectorILj16EhjiE4dataEv| Line | Count | Source |  | 493 | 2.68M |     const value_type* data() const { |  | 494 | 2.68M |         return item_ptr(0); |  | 495 | 2.68M |     } | 
Unexecuted instantiation: _ZNK9prevectorILj33EhjiE4dataEv | 
| 496 |  | }; | 
| 497 |  |  | 
| 498 |  | #endif // BITCOIN_PREVECTOR_H |