Coverage Report

Created: 2026-08-14 20:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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
99.9M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
84.9M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
441k
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::iterator::iterator(int*)
Line
Count
Source
60
14.4M
        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
740
        iterator(T* ptr_) : ptr(ptr_) {}
61
171M
        T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
159M
        T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
882k
        T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
11.4M
        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
740
        T& operator*() const { return *ptr; }
62
35.9k
        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
35.9k
        T* operator->() const { return ptr; }
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::iterator::operator->() const
63
2.06M
        T& operator[](size_type pos) const { return ptr[pos]; }
64
41.8M
        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.13M
        iterator& operator++() { ptr++; return *this; }
65
4.13M
        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
30.4M
        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
29.8M
        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
147k
        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
391k
        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
370
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
69
4.28M
        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.07M
        iterator operator-(size_type n) const { return iterator(ptr - n); }
73
        iterator& operator-=(size_type n) { ptr -= n; return *this; }
74
44.9M
        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.9M
        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
7.00M
        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.59G
        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.35M
        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.58G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::const_iterator::const_iterator(int const*)
Line
Count
Source
87
3.76M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
88
739k
        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.2G
        const T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
11.7M
        const T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
16.6M
        const T& operator*() const { return *ptr; }
90
3.84M
        const T* operator->() const { return ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
3.84M
        const T* operator->() const { return ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
476
        const T* operator->() const { return ptr; }
91
179k
        const T& operator[](size_type pos) const { return ptr[pos]; }
92
16.5G
        const_iterator& operator++() { ptr++; return *this; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
16.5G
        const_iterator& operator++() { ptr++; return *this; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
6.34M
        const_iterator& operator++() { ptr++; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
12.4M
        const_iterator& operator++() { ptr++; return *this; }
93
4.13M
        const_iterator& operator--() { ptr--; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator--()
Line
Count
Source
93
4.13M
        const_iterator& operator--() { ptr--; return *this; }
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator--()
94
673M
        const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
95
        const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
96
722M
        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
721M
        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
474k
        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
5.88M
        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
9.30M
        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.8G
        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.8G
        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.14M
        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.7M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
103
1.34G
        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.34G
        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
140M
    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
134M
    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.07M
    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
782k
    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.96M
    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
917
    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
1.48k
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
123
307M
    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
289M
    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
16.7M
    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
123k
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
124
34.9M
    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.5M
    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.32k
    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
14.3M
    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.32G
    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.32G
    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
5.73k
    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.14M
    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.27G
    bool is_direct() const { return _size <= N; }
prevector<36u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.21G
    bool is_direct() const { return _size <= N; }
prevector<16u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
31.4M
    bool is_direct() const { return _size <= N; }
prevector<33u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
2.18M
    bool is_direct() const { return _size <= N; }
prevector<8u, int, unsigned int, int>::is_direct() const
Line
Count
Source
126
29.1M
    bool is_direct() const { return _size <= N; }
prevector<4u, Network, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.66k
    bool is_direct() const { return _size <= N; }
prevector<35u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.51k
    bool is_direct() const { return _size <= N; }
127
128
155M
    void change_capacity(size_type new_capacity) {
129
155M
        if (new_capacity <= N) {
130
152M
            if (!is_direct()) {
131
44.9k
                T* indirect = indirect_ptr(0);
132
44.9k
                T* src = indirect;
133
44.9k
                T* dst = direct_ptr(0);
134
44.9k
                memcpy(dst, src, size() * sizeof(T));
135
44.9k
                free(indirect);
136
44.9k
                _size -= N + 1;
137
44.9k
            }
138
152M
        } else {
139
2.48M
            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
83.2k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
83.2k
                assert(_union.indirect_contents.indirect);
145
83.2k
                _union.indirect_contents.capacity = new_capacity;
146
2.40M
            } else {
147
2.40M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.40M
                assert(new_indirect);
149
2.40M
                T* src = direct_ptr(0);
150
2.40M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.40M
                memcpy(dst, src, size() * sizeof(T));
152
2.40M
                _union.indirect_contents.indirect = new_indirect;
153
2.40M
                _union.indirect_contents.capacity = new_capacity;
154
2.40M
                _size += N + 1;
155
2.40M
            }
156
2.48M
        }
157
155M
    }
prevector<36u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
153M
    void change_capacity(size_type new_capacity) {
129
153M
        if (new_capacity <= N) {
130
150M
            if (!is_direct()) {
131
44.3k
                T* indirect = indirect_ptr(0);
132
44.3k
                T* src = indirect;
133
44.3k
                T* dst = direct_ptr(0);
134
44.3k
                memcpy(dst, src, size() * sizeof(T));
135
44.3k
                free(indirect);
136
44.3k
                _size -= N + 1;
137
44.3k
            }
138
150M
        } 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.8k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
78.8k
                assert(_union.indirect_contents.indirect);
145
78.8k
                _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
153M
    }
prevector<16u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
1.48M
    void change_capacity(size_type new_capacity) {
129
1.48M
        if (new_capacity <= N) {
130
1.48M
            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.48M
        } else {
139
1.99k
            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
1.99k
            } else {
147
1.99k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
1.99k
                assert(new_indirect);
149
1.99k
                T* src = direct_ptr(0);
150
1.99k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
1.99k
                memcpy(dst, src, size() * sizeof(T));
152
1.99k
                _union.indirect_contents.indirect = new_indirect;
153
1.99k
                _union.indirect_contents.capacity = new_capacity;
154
1.99k
                _size += N + 1;
155
1.99k
            }
156
1.99k
        }
157
1.48M
    }
prevector<33u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
123k
    void change_capacity(size_type new_capacity) {
129
123k
        if (new_capacity <= N) {
130
123k
            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
123k
        } 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
123k
    }
prevector<8u, int, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
544k
    void change_capacity(size_type new_capacity) {
129
544k
        if (new_capacity <= N) {
130
336k
            if (!is_direct()) {
131
600
                T* indirect = indirect_ptr(0);
132
600
                T* src = indirect;
133
600
                T* dst = direct_ptr(0);
134
600
                memcpy(dst, src, size() * sizeof(T));
135
600
                free(indirect);
136
600
                _size -= N + 1;
137
600
            }
138
336k
        } else {
139
207k
            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.36k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
4.36k
                assert(_union.indirect_contents.indirect);
145
4.36k
                _union.indirect_contents.capacity = new_capacity;
146
203k
            } else {
147
203k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
203k
                assert(new_indirect);
149
203k
                T* src = direct_ptr(0);
150
203k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
203k
                memcpy(dst, src, size() * sizeof(T));
152
203k
                _union.indirect_contents.indirect = new_indirect;
153
203k
                _union.indirect_contents.capacity = new_capacity;
154
203k
                _size += N + 1;
155
203k
            }
156
207k
        }
157
544k
    }
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
185
    void change_capacity(size_type new_capacity) {
129
185
        if (new_capacity <= N) {
130
185
            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
185
        } 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
185
    }
158
159
173M
    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
153M
    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.07M
    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
782k
    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
17.1M
    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
917
    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
1.48k
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
160
1.63G
    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.61G
    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
16.7M
    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.76M
    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
123k
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
161
162
1.19M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
1.19M
        std::fill_n(dst, count, value);
164
1.19M
    }
prevector<36u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
583k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
583k
        std::fill_n(dst, count, value);
164
583k
    }
prevector<16u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
332k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
332k
        std::fill_n(dst, count, value);
164
332k
    }
prevector<33u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
257k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
257k
        std::fill_n(dst, count, value);
164
257k
    }
prevector<8u, int, unsigned int, int>::fill(int*, long, int const&)
Line
Count
Source
162
23.3k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
23.3k
        std::fill_n(dst, count, value);
164
23.3k
    }
165
166
    template <std::input_iterator InputIterator>
167
66.9M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.7G
        while (first != last) {
169
15.7G
            new(static_cast<void*>(dst)) T(*first);
170
15.7G
            ++dst;
171
15.7G
            ++first;
172
15.7G
        }
173
66.9M
    }
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.73M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
84.0M
        while (first != last) {
169
81.3M
            new(static_cast<void*>(dst)) T(*first);
170
81.3M
            ++dst;
171
81.3M
            ++first;
172
81.3M
        }
173
2.73M
    }
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.18M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
6.24M
        while (first != last) {
169
5.06M
            new(static_cast<void*>(dst)) T(*first);
170
5.06M
            ++dst;
171
5.06M
            ++first;
172
5.06M
        }
173
1.18M
    }
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
62.1M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.6G
        while (first != last) {
169
15.5G
            new(static_cast<void*>(dst)) T(*first);
170
15.5G
            ++dst;
171
15.5G
            ++first;
172
15.5G
        }
173
62.1M
    }
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.3k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.66M
        while (first != last) {
169
1.61M
            new(static_cast<void*>(dst)) T(*first);
170
1.61M
            ++dst;
171
1.61M
            ++first;
172
1.61M
        }
173
41.3k
    }
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
22.8k
    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
22.8k
    }
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
267k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.33M
        while (first != last) {
169
2.06M
            new(static_cast<void*>(dst)) T(*first);
170
2.06M
            ++dst;
171
2.06M
            ++first;
172
2.06M
        }
173
267k
    }
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
267k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.33M
        while (first != last) {
169
2.06M
            new(static_cast<void*>(dst)) T(*first);
170
2.06M
            ++dst;
171
2.06M
            ++first;
172
2.06M
        }
173
267k
    }
void prevector<8u, int, unsigned int, int>::fill<int*>(int*, int*, int*)
Line
Count
Source
167
4.20k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
14.7k
        while (first != last) {
169
10.5k
            new(static_cast<void*>(dst)) T(*first);
170
10.5k
            ++dst;
171
10.5k
            ++first;
172
10.5k
        }
173
4.20k
    }
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.07k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
54.3k
        while (first != last) {
169
46.2k
            new(static_cast<void*>(dst)) T(*first);
170
46.2k
            ++dst;
171
46.2k
            ++first;
172
46.2k
        }
173
8.07k
    }
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
217k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
25.0M
        while (first != last) {
169
24.8M
            new(static_cast<void*>(dst)) T(*first);
170
24.8M
            ++dst;
171
24.8M
            ++first;
172
24.8M
        }
173
217k
    }
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.1k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
92.5k
        while (first != last) {
169
82.3k
            new(static_cast<void*>(dst)) T(*first);
170
82.3k
            ++dst;
171
82.3k
            ++first;
172
82.3k
        }
173
10.1k
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
10
    void fill(T* dst, InputIterator first, InputIterator last) {
168
110
        while (first != last) {
169
100
            new(static_cast<void*>(dst)) T(*first);
170
100
            ++dst;
171
100
            ++first;
172
100
        }
173
10
    }
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
41
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.35k
        while (first != last) {
169
1.31k
            new(static_cast<void*>(dst)) T(*first);
170
1.31k
            ++dst;
171
1.31k
            ++first;
172
1.31k
        }
173
41
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
59.2k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
296k
        while (first != last) {
169
237k
            new(static_cast<void*>(dst)) T(*first);
170
237k
            ++dst;
171
237k
            ++first;
172
237k
        }
173
59.2k
    }
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
185
    void fill(T* dst, InputIterator first, InputIterator last) {
168
6.10k
        while (first != last) {
169
5.92k
            new(static_cast<void*>(dst)) T(*first);
170
5.92k
            ++dst;
171
5.92k
            ++first;
172
5.92k
        }
173
185
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
185
    void fill(T* dst, InputIterator first, InputIterator last) {
168
555
        while (first != last) {
169
370
            new(static_cast<void*>(dst)) T(*first);
170
370
            ++dst;
171
370
            ++first;
172
370
        }
173
185
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
185
    void fill(T* dst, InputIterator first, InputIterator last) {
168
370
        while (first != last) {
169
185
            new(static_cast<void*>(dst)) T(*first);
170
185
            ++dst;
171
185
            ++first;
172
185
        }
173
185
    }
174
175
public:
176
144k
    void assign(size_type n, const T& val) {
177
144k
        clear();
178
144k
        if (capacity() < n) {
179
94.6k
            change_capacity(n);
180
94.6k
        }
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.5k
            change_capacity(n);
180
94.5k
        }
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
233
    void assign(size_type n, const T& val) {
177
233
        clear();
178
233
        if (capacity() < n) {
179
114
            change_capacity(n);
180
114
        }
181
233
        _size += n;
182
233
        fill(item_ptr(0), n, val);
183
233
    }
184
185
    template <std::input_iterator InputIterator>
186
2.05M
    void assign(InputIterator first, InputIterator last) {
187
2.05M
        size_type n = last - first;
188
2.05M
        clear();
189
2.05M
        if (capacity() < n) {
190
120k
            change_capacity(n);
191
120k
        }
192
2.05M
        _size += n;
193
2.05M
        fill(item_ptr(0), first, last);
194
2.05M
    }
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
36.0k
    void assign(InputIterator first, InputIterator last) {
187
36.0k
        size_type n = last - first;
188
36.0k
        clear();
189
36.0k
        if (capacity() < n) {
190
52
            change_capacity(n);
191
52
        }
192
36.0k
        _size += n;
193
36.0k
        fill(item_ptr(0), first, last);
194
36.0k
    }
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
1.94M
    void assign(InputIterator first, InputIterator last) {
187
1.94M
        size_type n = last - first;
188
1.94M
        clear();
189
1.94M
        if (capacity() < n) {
190
119k
            change_capacity(n);
191
119k
        }
192
1.94M
        _size += n;
193
1.94M
        fill(item_ptr(0), first, last);
194
1.94M
    }
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.07k
    void assign(InputIterator first, InputIterator last) {
187
8.07k
        size_type n = last - first;
188
8.07k
        clear();
189
8.07k
        if (capacity() < n) {
190
621
            change_capacity(n);
191
621
        }
192
8.07k
        _size += n;
193
8.07k
        fill(item_ptr(0), first, last);
194
8.07k
    }
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.1k
    void assign(InputIterator first, InputIterator last) {
187
10.1k
        size_type n = last - first;
188
10.1k
        clear();
189
10.1k
        if (capacity() < n) {
190
65
            change_capacity(n);
191
65
        }
192
10.1k
        _size += n;
193
10.1k
        fill(item_ptr(0), first, last);
194
10.1k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char*>(unsigned char*, unsigned char*)
Line
Count
Source
186
10
    void assign(InputIterator first, InputIterator last) {
187
10
        size_type n = last - first;
188
10
        clear();
189
10
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
10
        _size += n;
193
10
        fill(item_ptr(0), first, last);
194
10
    }
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
41
    void assign(InputIterator first, InputIterator last) {
187
41
        size_type n = last - first;
188
41
        clear();
189
41
        if (capacity() < n) {
190
40
            change_capacity(n);
191
40
        }
192
41
        _size += n;
193
41
        fill(item_ptr(0), first, last);
194
41
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char const*>(unsigned char const*, unsigned char const*)
Line
Count
Source
186
59.2k
    void assign(InputIterator first, InputIterator last) {
187
59.2k
        size_type n = last - first;
188
59.2k
        clear();
189
59.2k
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
59.2k
        _size += n;
193
59.2k
        fill(item_ptr(0), first, last);
194
59.2k
    }
195
196
95.5M
    prevector() = default;
prevector<36u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
95.0M
    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
322
    prevector() = default;
197
198
    explicit prevector(size_type n) {
199
        resize(n);
200
    }
201
202
455k
    explicit prevector(size_type n, const T& val) {
203
455k
        change_capacity(n);
204
455k
        _size += n;
205
455k
        fill(item_ptr(0), n, val);
206
455k
    }
prevector<33u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
123k
    explicit prevector(size_type n, const T& val) {
203
123k
        change_capacity(n);
204
123k
        _size += n;
205
123k
        fill(item_ptr(0), n, val);
206
123k
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
332k
    explicit prevector(size_type n, const T& val) {
203
332k
        change_capacity(n);
204
332k
        _size += n;
205
332k
        fill(item_ptr(0), n, val);
206
332k
    }
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*, 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.5k
    prevector(InputIterator first, InputIterator last) {
210
38.5k
        size_type n = last - first;
211
38.5k
        change_capacity(n);
212
38.5k
        _size += n;
213
38.5k
        fill(item_ptr(0), first, last);
214
38.5k
    }
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
267k
    prevector(InputIterator first, InputIterator last) {
210
267k
        size_type n = last - first;
211
267k
        change_capacity(n);
212
267k
        _size += n;
213
267k
        fill(item_ptr(0), first, last);
214
267k
    }
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
267k
    prevector(InputIterator first, InputIterator last) {
210
267k
        size_type n = last - first;
211
267k
        change_capacity(n);
212
267k
        _size += n;
213
267k
        fill(item_ptr(0), first, last);
214
267k
    }
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.06k
    prevector(InputIterator first, InputIterator last) {
210
8.06k
        size_type n = last - first;
211
8.06k
        change_capacity(n);
212
8.06k
        _size += n;
213
8.06k
        fill(item_ptr(0), first, last);
214
8.06k
    }
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
217k
    prevector(InputIterator first, InputIterator last) {
210
217k
        size_type n = last - first;
211
217k
        change_capacity(n);
212
217k
        _size += n;
213
217k
        fill(item_ptr(0), first, last);
214
217k
    }
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
371k
    prevector(InputIterator first, InputIterator last) {
210
371k
        size_type n = last - first;
211
371k
        change_capacity(n);
212
371k
        _size += n;
213
371k
        fill(item_ptr(0), first, last);
214
371k
    }
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
185
    prevector(InputIterator first, InputIterator last) {
210
185
        size_type n = last - first;
211
185
        change_capacity(n);
212
185
        _size += n;
213
185
        fill(item_ptr(0), first, last);
214
185
    }
215
216
58.2M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
58.2M
        size_type n = other.size();
218
58.2M
        change_capacity(n);
219
58.2M
        _size += n;
220
58.2M
        fill(item_ptr(0), other.begin(),  other.end());
221
58.2M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
1.15M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
1.15M
        size_type n = other.size();
218
1.15M
        change_capacity(n);
219
1.15M
        _size += n;
220
1.15M
        fill(item_ptr(0), other.begin(),  other.end());
221
1.15M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
57.0M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
57.0M
        size_type n = other.size();
218
57.0M
        change_capacity(n);
219
57.0M
        _size += n;
220
57.0M
        fill(item_ptr(0), other.begin(),  other.end());
221
57.0M
    }
222
223
    prevector(prevector<N, T, Size, Diff>&& other) noexcept
224
16.4M
        : _union(std::move(other._union)), _size(other._size)
225
16.4M
    {
226
16.4M
        other._size = 0;
227
16.4M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
29.4k
        : _union(std::move(other._union)), _size(other._size)
225
29.4k
    {
226
29.4k
        other._size = 0;
227
29.4k
    }
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
1.99M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
1.99M
        if (&other == this) {
231
13.0k
            return *this;
232
13.0k
        }
233
1.98M
        assign(other.begin(), other.end());
234
1.98M
        return *this;
235
1.99M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
36.0k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
36.0k
        if (&other == this) {
231
2
            return *this;
232
2
        }
233
36.0k
        assign(other.begin(), other.end());
234
36.0k
        return *this;
235
36.0k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
1.95M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
1.95M
        if (&other == this) {
231
13.0k
            return *this;
232
13.0k
        }
233
1.94M
        assign(other.begin(), other.end());
234
1.94M
        return *this;
235
1.95M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int> const&)
Line
Count
Source
229
8.07k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
8.07k
        if (&other == this) {
231
0
            return *this;
232
0
        }
233
8.07k
        assign(other.begin(), other.end());
234
8.07k
        return *this;
235
8.07k
    }
236
237
42.9M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
42.9M
        if (!is_direct()) {
239
25.6k
            free(_union.indirect_contents.indirect);
240
25.6k
        }
241
42.9M
        _union = std::move(other._union);
242
42.9M
        _size = other._size;
243
42.9M
        other._size = 0;
244
42.9M
        return *this;
245
42.9M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
91.8k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
91.8k
        if (!is_direct()) {
239
8
            free(_union.indirect_contents.indirect);
240
8
        }
241
91.8k
        _union = std::move(other._union);
242
91.8k
        _size = other._size;
243
91.8k
        other._size = 0;
244
91.8k
        return *this;
245
91.8k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
42.8M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
42.8M
        if (!is_direct()) {
239
23.0k
            free(_union.indirect_contents.indirect);
240
23.0k
        }
241
42.8M
        _union = std::move(other._union);
242
42.8M
        _size = other._size;
243
42.8M
        other._size = 0;
244
42.8M
        return *this;
245
42.8M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int>&&)
Line
Count
Source
237
4.24k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
4.24k
        if (!is_direct()) {
239
2.59k
            free(_union.indirect_contents.indirect);
240
2.59k
        }
241
4.24k
        _union = std::move(other._union);
242
4.24k
        _size = other._size;
243
4.24k
        other._size = 0;
244
4.24k
        return *this;
245
4.24k
    }
246
247
2.02G
    size_type size() const {
248
2.02G
        return is_direct() ? _size : _size - N - 1;
249
2.02G
    }
prevector<36u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
2.00G
    size_type size() const {
248
2.00G
        return is_direct() ? _size : _size - N - 1;
249
2.00G
    }
prevector<16u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
9.41M
    size_type size() const {
248
9.41M
        return is_direct() ? _size : _size - N - 1;
249
9.41M
    }
prevector<33u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
391k
    size_type size() const {
248
391k
        return is_direct() ? _size : _size - N - 1;
249
391k
    }
prevector<8u, int, unsigned int, int>::size() const
Line
Count
Source
247
7.11M
    size_type size() const {
248
7.11M
        return is_direct() ? _size : _size - N - 1;
249
7.11M
    }
prevector<4u, Network, unsigned int, int>::size() const
Line
Count
Source
247
1.83k
    size_type size() const {
248
1.83k
        return is_direct() ? _size : _size - N - 1;
249
1.83k
    }
prevector<35u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.29k
    size_type size() const {
248
1.29k
        return is_direct() ? _size : _size - N - 1;
249
1.29k
    }
250
251
31.7M
    bool empty() const {
252
31.7M
        return size() == 0;
253
31.7M
    }
prevector<36u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
31.3M
    bool empty() const {
252
31.3M
        return size() == 0;
253
31.3M
    }
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
267k
    bool empty() const {
252
267k
        return size() == 0;
253
267k
    }
prevector<4u, Network, unsigned int, int>::empty() const
Line
Count
Source
251
322
    bool empty() const {
252
322
        return size() == 0;
253
322
    }
254
255
20.3M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
15.2M
    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
5.11M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<35u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
370
    iterator begin() { return iterator(item_ptr(0)); }
256
153M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
146M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<16u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
5.70M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<8u, int, unsigned int, int>::begin() const
Line
Count
Source
256
1.88M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
257
48.7M
    iterator end() { return iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
45.4M
    iterator end() { return iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
294k
    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.97M
    iterator end() { return iterator(item_ptr(size())); }
prevector<35u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
370
    iterator end() { return iterator(item_ptr(size())); }
258
1.43G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.42G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.65M
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<8u, int, unsigned int, int>::end() const
Line
Count
Source
258
1.88M
    const_iterator end() const { return const_iterator(item_ptr(size())); }
259
260
18.5M
    size_t capacity() const {
261
18.5M
        if (is_direct()) {
262
12.6M
            return N;
263
12.6M
        } else {
264
5.87M
            return _union.indirect_contents.capacity;
265
5.87M
        }
266
18.5M
    }
prevector<36u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
18.1M
    size_t capacity() const {
261
18.1M
        if (is_direct()) {
262
12.3M
            return N;
263
12.3M
        } else {
264
5.81M
            return _union.indirect_contents.capacity;
265
5.81M
        }
266
18.1M
    }
prevector<16u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
105k
    size_t capacity() const {
261
105k
        if (is_direct()) {
262
105k
            return N;
263
105k
        } else {
264
10
            return _union.indirect_contents.capacity;
265
10
        }
266
105k
    }
prevector<8u, int, unsigned int, int>::capacity() const
Line
Count
Source
260
93.0k
    size_t capacity() const {
261
93.0k
        if (is_direct()) {
262
34.8k
            return N;
263
58.2k
        } else {
264
58.2k
            return _union.indirect_contents.capacity;
265
58.2k
        }
266
93.0k
    }
prevector<4u, Network, unsigned int, int>::capacity() const
Line
Count
Source
260
595
    size_t capacity() const {
261
595
        if (is_direct()) {
262
595
            return N;
263
595
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
595
    }
prevector<33u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
134k
    size_t capacity() const {
261
134k
        if (is_direct()) {
262
134k
            return N;
263
134k
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
134k
    }
prevector<35u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
370
    size_t capacity() const {
261
370
        if (is_direct()) {
262
370
            return N;
263
370
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
370
    }
267
268
10.8M
    T& operator[](size_type pos) {
269
10.8M
        return *item_ptr(pos);
270
10.8M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
2.17M
    T& operator[](size_type pos) {
269
2.17M
        return *item_ptr(pos);
270
2.17M
    }
prevector<33u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
268k
    T& operator[](size_type pos) {
269
268k
        return *item_ptr(pos);
270
268k
    }
prevector<8u, int, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
8.41M
    T& operator[](size_type pos) {
269
8.41M
        return *item_ptr(pos);
270
8.41M
    }
prevector<4u, Network, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
322
    T& operator[](size_type pos) {
269
322
        return *item_ptr(pos);
270
322
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
5.18k
    T& operator[](size_type pos) {
269
5.18k
        return *item_ptr(pos);
270
5.18k
    }
271
272
17.9M
    const T& operator[](size_type pos) const {
273
17.9M
        return *item_ptr(pos);
274
17.9M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
10.8M
    const T& operator[](size_type pos) const {
273
10.8M
        return *item_ptr(pos);
274
10.8M
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
7.17M
    const T& operator[](size_type pos) const {
273
7.17M
        return *item_ptr(pos);
274
7.17M
    }
275
276
98.5M
    void resize(size_type new_size) {
277
98.5M
        size_type cur_size = size();
278
98.5M
        if (cur_size == new_size) {
279
82.5M
            return;
280
82.5M
        }
281
15.9M
        if (cur_size > new_size) {
282
15.3M
            erase(item_ptr(new_size), end());
283
15.3M
            return;
284
15.3M
        }
285
580k
        if (new_size > capacity()) {
286
86.9k
            change_capacity(new_size);
287
86.9k
        }
288
580k
        ptrdiff_t increase = new_size - cur_size;
289
580k
        fill(item_ptr(cur_size), increase);
290
580k
        _size += increase;
291
580k
    }
prevector<36u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
98.2M
    void resize(size_type new_size) {
277
98.2M
        size_type cur_size = size();
278
98.2M
        if (cur_size == new_size) {
279
82.5M
            return;
280
82.5M
        }
281
15.6M
        if (cur_size > new_size) {
282
15.2M
            erase(item_ptr(new_size), end());
283
15.2M
            return;
284
15.2M
        }
285
439k
        if (new_size > capacity()) {
286
86.3k
            change_capacity(new_size);
287
86.3k
        }
288
439k
        ptrdiff_t increase = new_size - cur_size;
289
439k
        fill(item_ptr(cur_size), increase);
290
439k
        _size += increase;
291
439k
    }
prevector<16u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
147k
    void resize(size_type new_size) {
277
147k
        size_type cur_size = size();
278
147k
        if (cur_size == new_size) {
279
101
            return;
280
101
        }
281
147k
        if (cur_size > new_size) {
282
147k
            erase(item_ptr(new_size), end());
283
147k
            return;
284
147k
        }
285
284
        if (new_size > capacity()) {
286
282
            change_capacity(new_size);
287
282
        }
288
284
        ptrdiff_t increase = new_size - cur_size;
289
284
        fill(item_ptr(cur_size), increase);
290
284
        _size += increase;
291
284
    }
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.2k
            return;
280
10.2k
        }
281
18.8k
        if (cur_size > new_size) {
282
12.1k
            erase(item_ptr(new_size), end());
283
12.1k
            return;
284
12.1k
        }
285
6.64k
        if (new_size > capacity()) {
286
310
            change_capacity(new_size);
287
310
        }
288
6.64k
        ptrdiff_t increase = new_size - cur_size;
289
6.64k
        fill(item_ptr(cur_size), increase);
290
6.64k
        _size += increase;
291
6.64k
    }
prevector<33u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
134k
    void resize(size_type new_size) {
277
134k
        size_type cur_size = size();
278
134k
        if (cur_size == new_size) {
279
0
            return;
280
0
        }
281
134k
        if (cur_size > new_size) {
282
0
            erase(item_ptr(new_size), end());
283
0
            return;
284
0
        }
285
134k
        if (new_size > capacity()) {
286
0
            change_capacity(new_size);
287
0
        }
288
134k
        ptrdiff_t increase = new_size - cur_size;
289
134k
        fill(item_ptr(cur_size), increase);
290
134k
        _size += increase;
291
134k
    }
292
293
4.07k
    void reserve(size_type new_capacity) {
294
4.07k
        if (new_capacity > capacity()) {
295
1.81k
            change_capacity(new_capacity);
296
1.81k
        }
297
4.07k
    }
298
299
94.3M
    void shrink_to_fit() {
300
94.3M
        change_capacity(size());
301
94.3M
    }
prevector<36u, unsigned char, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
94.3M
    void shrink_to_fit() {
300
94.3M
        change_capacity(size());
301
94.3M
    }
prevector<8u, int, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
2.08k
    void shrink_to_fit() {
300
2.08k
        change_capacity(size());
301
2.08k
    }
302
303
97.8M
    void clear() {
304
97.8M
        resize(0);
305
97.8M
    }
prevector<36u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
97.7M
    void clear() {
304
97.7M
        resize(0);
305
97.7M
    }
prevector<16u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
105k
    void clear() {
304
105k
        resize(0);
305
105k
    }
prevector<8u, int, unsigned int, int>::clear()
Line
Count
Source
303
12.6k
    void clear() {
304
12.6k
        resize(0);
305
12.6k
    }
306
307
9.07M
    iterator insert(iterator pos, const T& value) {
308
9.07M
        size_type p = pos - begin();
309
9.07M
        size_type new_size = size() + 1;
310
9.07M
        if (capacity() < new_size) {
311
8.14k
            change_capacity(new_size + (new_size >> 1));
312
8.14k
        }
313
9.07M
        T* ptr = item_ptr(p);
314
9.07M
        T* dst = ptr + 1;
315
9.07M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.07M
        _size++;
317
9.07M
        new(static_cast<void*>(ptr)) T(value);
318
9.07M
        return iterator(ptr);
319
9.07M
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const&)
Line
Count
Source
307
9.04M
    iterator insert(iterator pos, const T& value) {
308
9.04M
        size_type p = pos - begin();
309
9.04M
        size_type new_size = size() + 1;
310
9.04M
        if (capacity() < new_size) {
311
6.65k
            change_capacity(new_size + (new_size >> 1));
312
6.65k
        }
313
9.04M
        T* ptr = item_ptr(p);
314
9.04M
        T* dst = ptr + 1;
315
9.04M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.04M
        _size++;
317
9.04M
        new(static_cast<void*>(ptr)) T(value);
318
9.04M
        return iterator(ptr);
319
9.04M
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, int const&)
Line
Count
Source
307
32.9k
    iterator insert(iterator pos, const T& value) {
308
32.9k
        size_type p = pos - begin();
309
32.9k
        size_type new_size = size() + 1;
310
32.9k
        if (capacity() < new_size) {
311
1.48k
            change_capacity(new_size + (new_size >> 1));
312
1.48k
        }
313
32.9k
        T* ptr = item_ptr(p);
314
32.9k
        T* dst = ptr + 1;
315
32.9k
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
32.9k
        _size++;
317
32.9k
        new(static_cast<void*>(ptr)) T(value);
318
32.9k
        return iterator(ptr);
319
32.9k
    }
320
321
16.4k
    void insert(iterator pos, size_type count, const T& value) {
322
16.4k
        size_type p = pos - begin();
323
16.4k
        size_type new_size = size() + count;
324
16.4k
        if (capacity() < new_size) {
325
827
            change_capacity(new_size + (new_size >> 1));
326
827
        }
327
16.4k
        T* ptr = item_ptr(p);
328
16.4k
        T* dst = ptr + count;
329
16.4k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.4k
        _size += count;
331
16.4k
        fill(item_ptr(p), count, value);
332
16.4k
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, unsigned int, int const&)
Line
Count
Source
321
16.4k
    void insert(iterator pos, size_type count, const T& value) {
322
16.4k
        size_type p = pos - begin();
323
16.4k
        size_type new_size = size() + count;
324
16.4k
        if (capacity() < new_size) {
325
820
            change_capacity(new_size + (new_size >> 1));
326
820
        }
327
16.4k
        T* ptr = item_ptr(p);
328
16.4k
        T* dst = ptr + count;
329
16.4k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.4k
        _size += count;
331
16.4k
        fill(item_ptr(p), count, value);
332
16.4k
    }
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.50M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
5.50M
        size_type p = pos - begin();
337
5.50M
        difference_type count = last - first;
338
5.50M
        size_type new_size = size() + count;
339
5.50M
        if (capacity() < new_size) {
340
370k
            change_capacity(new_size + (new_size >> 1));
341
370k
        }
342
5.50M
        T* ptr = item_ptr(p);
343
5.50M
        T* dst = ptr + count;
344
5.50M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
5.50M
        _size += count;
346
5.50M
        fill(ptr, first, last);
347
5.50M
    }
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.73M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.73M
        size_type p = pos - begin();
337
2.73M
        difference_type count = last - first;
338
2.73M
        size_type new_size = size() + count;
339
2.73M
        if (capacity() < new_size) {
340
224k
            change_capacity(new_size + (new_size >> 1));
341
224k
        }
342
2.73M
        T* ptr = item_ptr(p);
343
2.73M
        T* dst = ptr + count;
344
2.73M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.73M
        _size += count;
346
2.73M
        fill(ptr, first, last);
347
2.73M
    }
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
22.8k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
22.8k
        size_type p = pos - begin();
337
22.8k
        difference_type count = last - first;
338
22.8k
        size_type new_size = size() + count;
339
22.8k
        if (capacity() < new_size) {
340
17.1k
            change_capacity(new_size + (new_size >> 1));
341
17.1k
        }
342
22.8k
        T* ptr = item_ptr(p);
343
22.8k
        T* dst = ptr + count;
344
22.8k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
22.8k
        _size += count;
346
22.8k
        fill(ptr, first, last);
347
22.8k
    }
void prevector<8u, int, unsigned int, int>::insert<int*>(prevector<8u, int, unsigned int, int>::iterator, int*, int*)
Line
Count
Source
335
4.20k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
4.20k
        size_type p = pos - begin();
337
4.20k
        difference_type count = last - first;
338
4.20k
        size_type new_size = size() + count;
339
4.20k
        if (capacity() < new_size) {
340
335
            change_capacity(new_size + (new_size >> 1));
341
335
        }
342
4.20k
        T* ptr = item_ptr(p);
343
4.20k
        T* dst = ptr + count;
344
4.20k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
4.20k
        _size += count;
346
4.20k
        fill(ptr, first, last);
347
4.20k
    }
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.75k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.75k
        size_type p = pos - begin();
337
2.75k
        difference_type count = last - first;
338
2.75k
        size_type new_size = size() + count;
339
2.75k
        if (capacity() < new_size) {
340
238
            change_capacity(new_size + (new_size >> 1));
341
238
        }
342
2.75k
        T* ptr = item_ptr(p);
343
2.75k
        T* dst = ptr + count;
344
2.75k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.75k
        _size += count;
346
2.75k
        fill(ptr, first, last);
347
2.75k
    }
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.74M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.74M
        size_type p = pos - begin();
337
2.74M
        difference_type count = last - first;
338
2.74M
        size_type new_size = size() + count;
339
2.74M
        if (capacity() < new_size) {
340
128k
            change_capacity(new_size + (new_size >> 1));
341
128k
        }
342
2.74M
        T* ptr = item_ptr(p);
343
2.74M
        T* dst = ptr + count;
344
2.74M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.74M
        _size += count;
346
2.74M
        fill(ptr, first, last);
347
2.74M
    }
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
185
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
185
        size_type p = pos - begin();
337
185
        difference_type count = last - first;
338
185
        size_type new_size = size() + count;
339
185
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
185
        T* ptr = item_ptr(p);
343
185
        T* dst = ptr + count;
344
185
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
185
        _size += count;
346
185
        fill(ptr, first, last);
347
185
    }
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
185
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
185
        size_type p = pos - begin();
337
185
        difference_type count = last - first;
338
185
        size_type new_size = size() + count;
339
185
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
185
        T* ptr = item_ptr(p);
343
185
        T* dst = ptr + count;
344
185
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
185
        _size += count;
346
185
        fill(ptr, first, last);
347
185
    }
348
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
240k
            change_capacity(new_size);
354
240k
            _size += new_size - size();
355
240k
            return;
356
240k
        }
357
832k
        if (new_size < size()) {
358
3.26k
            erase(item_ptr(new_size), end());
359
829k
        } else {
360
829k
            _size += new_size - size();
361
829k
        }
362
832k
    }
prevector<36u, unsigned char, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
1.06M
    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.06M
        if (capacity() < new_size) {
353
239k
            change_capacity(new_size);
354
239k
            _size += new_size - size();
355
239k
            return;
356
239k
        }
357
825k
        if (new_size < size()) {
358
0
            erase(item_ptr(new_size), end());
359
825k
        } else {
360
825k
            _size += new_size - size();
361
825k
        }
362
825k
    }
prevector<8u, int, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
8.31k
    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
8.31k
        if (capacity() < new_size) {
353
1.19k
            change_capacity(new_size);
354
1.19k
            _size += new_size - size();
355
1.19k
            return;
356
1.19k
        }
357
7.11k
        if (new_size < size()) {
358
3.26k
            erase(item_ptr(new_size), end());
359
3.85k
        } else {
360
3.85k
            _size += new_size - size();
361
3.85k
        }
362
7.11k
    }
363
364
27.6k
    iterator erase(iterator pos) {
365
27.6k
        return erase(pos, pos + 1);
366
27.6k
    }
367
368
15.4M
    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
15.4M
        iterator p = first;
376
15.4M
        char* endp = (char*)&(*end());
377
15.4M
        _size -= last - p;
378
15.4M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
15.4M
        return first;
380
15.4M
    }
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
15.2M
    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
15.2M
        iterator p = first;
376
15.2M
        char* endp = (char*)&(*end());
377
15.2M
        _size -= last - p;
378
15.2M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
15.2M
        return first;
380
15.2M
    }
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
147k
    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
147k
        iterator p = first;
376
147k
        char* endp = (char*)&(*end());
377
147k
        _size -= last - p;
378
147k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
147k
        return first;
380
147k
    }
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
70.3k
    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
70.3k
        iterator p = first;
376
70.3k
        char* endp = (char*)&(*end());
377
70.3k
        _size -= last - p;
378
70.3k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
70.3k
        return first;
380
70.3k
    }
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
81.8k
    void emplace_back(Args&&... args) {
384
81.8k
        size_type new_size = size() + 1;
385
81.8k
        if (capacity() < new_size) {
386
13.3k
            change_capacity(new_size + (new_size >> 1));
387
13.3k
        }
388
81.8k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
81.8k
        _size++;
390
81.8k
    }
void prevector<36u, unsigned char, unsigned int, int>::emplace_back<unsigned char const&>(unsigned char const&)
Line
Count
Source
383
73.1k
    void emplace_back(Args&&... args) {
384
73.1k
        size_type new_size = size() + 1;
385
73.1k
        if (capacity() < new_size) {
386
13.0k
            change_capacity(new_size + (new_size >> 1));
387
13.0k
        }
388
73.1k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
73.1k
        _size++;
390
73.1k
    }
void prevector<8u, int, unsigned int, int>::emplace_back<int const&>(int const&)
Line
Count
Source
383
8.05k
    void emplace_back(Args&&... args) {
384
8.05k
        size_type new_size = size() + 1;
385
8.05k
        if (capacity() < new_size) {
386
229
            change_capacity(new_size + (new_size >> 1));
387
229
        }
388
8.05k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
8.05k
        _size++;
390
8.05k
    }
void prevector<4u, Network, unsigned int, int>::emplace_back<Network const&>(Network const&)
Line
Count
Source
383
595
    void emplace_back(Args&&... args) {
384
595
        size_type new_size = size() + 1;
385
595
        if (capacity() < new_size) {
386
0
            change_capacity(new_size + (new_size >> 1));
387
0
        }
388
595
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
595
        _size++;
390
595
    }
391
392
81.8k
    void push_back(const T& value) {
393
81.8k
        emplace_back(value);
394
81.8k
    }
prevector<36u, unsigned char, unsigned int, int>::push_back(unsigned char const&)
Line
Count
Source
392
73.1k
    void push_back(const T& value) {
393
73.1k
        emplace_back(value);
394
73.1k
    }
prevector<8u, int, unsigned int, int>::push_back(int const&)
Line
Count
Source
392
8.05k
    void push_back(const T& value) {
393
8.05k
        emplace_back(value);
394
8.05k
    }
prevector<4u, Network, unsigned int, int>::push_back(Network const&)
Line
Count
Source
392
595
    void push_back(const T& value) {
393
595
        emplace_back(value);
394
595
    }
395
396
6.78k
    void pop_back() {
397
6.78k
        erase(end() - 1, end());
398
6.78k
    }
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
27.9k
    const T& back() const {
413
27.9k
        return *item_ptr(size() - 1);
414
27.9k
    }
415
416
    void swap(prevector<N, T, Size, Diff>& other) noexcept
417
16.5k
    {
418
16.5k
        std::swap(_union, other._union);
419
16.5k
        std::swap(_size, other._size);
420
16.5k
    }
421
422
171M
    ~prevector() {
423
171M
        if (!is_direct()) {
424
2.33M
            free(_union.indirect_contents.indirect);
425
2.33M
            _union.indirect_contents.indirect = nullptr;
426
2.33M
        }
427
171M
    }
prevector<16u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
1.48M
    ~prevector() {
423
1.48M
        if (!is_direct()) {
424
1.98k
            free(_union.indirect_contents.indirect);
425
1.98k
            _union.indirect_contents.indirect = nullptr;
426
1.98k
        }
427
1.48M
    }
prevector<36u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
169M
    ~prevector() {
423
169M
        if (!is_direct()) {
424
2.12M
            free(_union.indirect_contents.indirect);
425
2.12M
            _union.indirect_contents.indirect = nullptr;
426
2.12M
        }
427
169M
    }
prevector<33u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
627k
    ~prevector() {
423
627k
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
627k
    }
prevector<8u, int, unsigned int, int>::~prevector()
Line
Count
Source
422
535k
    ~prevector() {
423
535k
        if (!is_direct()) {
424
200k
            free(_union.indirect_contents.indirect);
425
200k
            _union.indirect_contents.indirect = nullptr;
426
200k
        }
427
535k
    }
prevector<4u, Network, unsigned int, int>::~prevector()
Line
Count
Source
422
322
    ~prevector() {
423
322
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
322
    }
prevector<35u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
185
    ~prevector() {
423
185
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
185
    }
428
429
6.47M
    constexpr bool operator==(const prevector& other) const {
430
6.47M
        return std::ranges::equal(*this, other);
431
6.47M
    }
prevector<36u, unsigned char, unsigned int, int>::operator==(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
5.72M
    constexpr bool operator==(const prevector& other) const {
430
5.72M
        return std::ranges::equal(*this, other);
431
5.72M
    }
prevector<8u, int, unsigned int, int>::operator==(prevector<8u, int, unsigned int, int> const&) const
Line
Count
Source
429
535k
    constexpr bool operator==(const prevector& other) const {
430
535k
        return std::ranges::equal(*this, other);
431
535k
    }
prevector<16u, unsigned char, unsigned int, int>::operator==(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
218k
    constexpr bool operator==(const prevector& other) const {
430
218k
        return std::ranges::equal(*this, other);
431
218k
    }
432
433
21.3M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.3M
        if (size() < other.size()) {
435
880k
            return true;
436
880k
        }
437
20.4M
        if (size() > other.size()) {
438
320k
            return false;
439
320k
        }
440
20.1M
        const_iterator b1 = begin();
441
20.1M
        const_iterator b2 = other.begin();
442
20.1M
        const_iterator e1 = end();
443
126M
        while (b1 != e1) {
444
123M
            if ((*b1) < (*b2)) {
445
10.0M
                return true;
446
10.0M
            }
447
113M
            if ((*b2) < (*b1)) {
448
7.60M
                return false;
449
7.60M
            }
450
106M
            ++b1;
451
106M
            ++b2;
452
106M
        }
453
2.44M
        return false;
454
20.1M
    }
prevector<36u, unsigned char, unsigned int, int>::operator<(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
21.3M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.3M
        if (size() < other.size()) {
435
880k
            return true;
436
880k
        }
437
20.4M
        if (size() > other.size()) {
438
320k
            return false;
439
320k
        }
440
20.1M
        const_iterator b1 = begin();
441
20.1M
        const_iterator b2 = other.begin();
442
20.1M
        const_iterator e1 = end();
443
126M
        while (b1 != e1) {
444
123M
            if ((*b1) < (*b2)) {
445
10.0M
                return true;
446
10.0M
            }
447
113M
            if ((*b2) < (*b1)) {
448
7.60M
                return false;
449
7.60M
            }
450
106M
            ++b1;
451
106M
            ++b2;
452
106M
        }
453
2.41M
        return false;
454
20.1M
    }
prevector<16u, unsigned char, unsigned int, int>::operator<(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
27.8k
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
27.8k
        if (size() < other.size()) {
435
0
            return true;
436
0
        }
437
27.8k
        if (size() > other.size()) {
438
0
            return false;
439
0
        }
440
27.8k
        const_iterator b1 = begin();
441
27.8k
        const_iterator b2 = other.begin();
442
27.8k
        const_iterator e1 = end();
443
140k
        while (b1 != e1) {
444
112k
            if ((*b1) < (*b2)) {
445
301
                return true;
446
301
            }
447
112k
            if ((*b2) < (*b1)) {
448
108
                return false;
449
108
            }
450
112k
            ++b1;
451
112k
            ++b2;
452
112k
        }
453
27.4k
        return false;
454
27.8k
    }
455
456
57.7M
    size_t allocated_memory() const {
457
57.7M
        if (is_direct()) {
458
56.7M
            return 0;
459
56.7M
        } else {
460
980k
            return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity;
461
980k
        }
462
57.7M
    }
463
464
601k
    value_type* data() {
465
601k
        return item_ptr(0);
466
601k
    }
prevector<16u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
41.9k
    value_type* data() {
465
41.9k
        return item_ptr(0);
466
41.9k
    }
prevector<33u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
257k
    value_type* data() {
465
257k
        return item_ptr(0);
466
257k
    }
prevector<36u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
301k
    value_type* data() {
465
301k
        return item_ptr(0);
466
301k
    }
prevector<35u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
185
    value_type* data() {
465
185
        return item_ptr(0);
466
185
    }
467
468
31.4M
    const value_type* data() const {
469
31.4M
        return item_ptr(0);
470
31.4M
    }
prevector<36u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
29.0M
    const value_type* data() const {
469
29.0M
        return item_ptr(0);
470
29.0M
    }
prevector<16u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
2.22M
    const value_type* data() const {
469
2.22M
        return item_ptr(0);
470
2.22M
    }
prevector<33u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
123k
    const value_type* data() const {
469
123k
        return item_ptr(0);
470
123k
    }
471
};
472
473
#endif // BITCOIN_PREVECTOR_H