Coverage Report

Created: 2026-06-16 16:41

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.8M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
82.8M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
2.03M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::iterator::iterator(int*)
Line
Count
Source
60
15.0M
        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
776
        iterator(T* ptr_) : ptr(ptr_) {}
61
170M
        T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
155M
        T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
4.06M
        T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
11.8M
        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
776
        T& operator*() const { return *ptr; }
62
35.0k
        T* operator->() const { return ptr; }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::iterator::operator->() const
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::iterator::operator->() const
prevector<36u, unsigned char, unsigned int, int>::iterator::operator->() const
Line
Count
Source
62
35.0k
        T* operator->() const { return ptr; }
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::iterator::operator->() const
63
2.15M
        T& operator[](size_type pos) const { return ptr[pos]; }
64
42.0M
        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.30M
        iterator& operator++() { ptr++; return *this; }
65
4.30M
        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.2M
        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.1M
        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
678k
        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
388
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
69
4.45M
        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.16M
        iterator operator-(size_type n) const { return iterator(ptr - n); }
73
        iterator& operator-=(size_type n) { ptr -= n; return *this; }
74
45.1M
        bool operator==(iterator x) const { return ptr == x.ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator==(prevector<36u, unsigned char, unsigned int, int>::iterator) const
Line
Count
Source
74
37.8M
        bool operator==(iterator x) const { return ptr == x.ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator==(prevector<8u, int, unsigned int, int>::iterator) const
Line
Count
Source
74
7.26M
        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.60G
        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
11.2M
        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
740k
        const_iterator(iterator x) : ptr(&(*x)) {}
89
18.3G
        const T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
18.3G
        const T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
19.5M
        const T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
17.2M
        const T& operator*() const { return *ptr; }
90
3.83M
        const T* operator->() const { return ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
3.83M
        const T* operator->() const { return ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
503
        const T* operator->() const { return ptr; }
91
180k
        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
14.1M
        const_iterator& operator++() { ptr++; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
12.9M
        const_iterator& operator++() { ptr++; return *this; }
93
4.30M
        const_iterator& operator--() { ptr--; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator--()
Line
Count
Source
93
4.30M
        const_iterator& operator--() { ptr--; return *this; }
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator--()
94
680M
        const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
95
        const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
96
730M
        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
728M
        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
475k
        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.95M
        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.11M
        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.7G
        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
16.8M
        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
12.1M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
103
1.35G
        auto 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
103
1.35G
        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
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
142M
    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
130M
    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
8.28M
    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
686k
    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.85M
    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
456
    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.55k
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
123
309M
    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
285M
    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
22.5M
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
prevector<8u, int, unsigned int, int>::direct_ptr(int) const
Line
Count
Source
123
1.56M
    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
88.2k
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
124
35.5M
    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.4M
    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.43k
    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
15.1M
    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.33G
    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.33G
    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
6.01k
    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.20M
    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.29G
    bool is_direct() const { return _size <= N; }
prevector<36u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.19G
    bool is_direct() const { return _size <= N; }
prevector<16u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
60.1M
    bool is_direct() const { return _size <= N; }
prevector<33u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
1.90M
    bool is_direct() const { return _size <= N; }
prevector<8u, int, unsigned int, int>::is_direct() const
Line
Count
Source
126
29.9M
    bool is_direct() const { return _size <= N; }
prevector<4u, Network, unsigned int, int>::is_direct() const
Line
Count
Source
126
1.82k
    bool is_direct() const { return _size <= N; }
prevector<35u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.68k
    bool is_direct() const { return _size <= N; }
127
128
153M
    void change_capacity(size_type new_capacity) {
129
153M
        if (new_capacity <= N) {
130
151M
            if (!is_direct()) {
131
45.3k
                T* indirect = indirect_ptr(0);
132
45.3k
                T* src = indirect;
133
45.3k
                T* dst = direct_ptr(0);
134
45.3k
                memcpy(dst, src, size() * sizeof(T));
135
45.3k
                free(indirect);
136
45.3k
                _size -= N + 1;
137
45.3k
            }
138
151M
        } else {
139
2.43M
            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.35M
            } else {
147
2.35M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.35M
                assert(new_indirect);
149
2.35M
                T* src = direct_ptr(0);
150
2.35M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.35M
                memcpy(dst, src, size() * sizeof(T));
152
2.35M
                _union.indirect_contents.indirect = new_indirect;
153
2.35M
                _union.indirect_contents.capacity = new_capacity;
154
2.35M
                _size += N + 1;
155
2.35M
            }
156
2.43M
        }
157
153M
    }
prevector<36u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
147M
    void change_capacity(size_type new_capacity) {
129
147M
        if (new_capacity <= N) {
130
145M
            if (!is_direct()) {
131
44.6k
                T* indirect = indirect_ptr(0);
132
44.6k
                T* src = indirect;
133
44.6k
                T* dst = direct_ptr(0);
134
44.6k
                memcpy(dst, src, size() * sizeof(T));
135
44.6k
                free(indirect);
136
44.6k
                _size -= N + 1;
137
44.6k
            }
138
145M
        } else {
139
2.22M
            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.14M
            } else {
147
2.14M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.14M
                assert(new_indirect);
149
2.14M
                T* src = direct_ptr(0);
150
2.14M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.14M
                memcpy(dst, src, size() * sizeof(T));
152
2.14M
                _union.indirect_contents.indirect = new_indirect;
153
2.14M
                _union.indirect_contents.capacity = new_capacity;
154
2.14M
                _size += N + 1;
155
2.14M
            }
156
2.22M
        }
157
147M
    }
prevector<16u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
5.57M
    void change_capacity(size_type new_capacity) {
129
5.57M
        if (new_capacity <= N) {
130
5.57M
            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
5.57M
        } else {
139
2.10k
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
0
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
0
                assert(_union.indirect_contents.indirect);
145
0
                _union.indirect_contents.capacity = new_capacity;
146
2.10k
            } else {
147
2.10k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.10k
                assert(new_indirect);
149
2.10k
                T* src = direct_ptr(0);
150
2.10k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.10k
                memcpy(dst, src, size() * sizeof(T));
152
2.10k
                _union.indirect_contents.indirect = new_indirect;
153
2.10k
                _union.indirect_contents.capacity = new_capacity;
154
2.10k
                _size += N + 1;
155
2.10k
            }
156
2.10k
        }
157
5.57M
    }
prevector<33u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
88.2k
    void change_capacity(size_type new_capacity) {
129
88.2k
        if (new_capacity <= N) {
130
88.2k
            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
88.2k
        } 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
88.2k
    }
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
329k
            if (!is_direct()) {
131
630
                T* indirect = indirect_ptr(0);
132
630
                T* src = indirect;
133
630
                T* dst = direct_ptr(0);
134
630
                memcpy(dst, src, size() * sizeof(T));
135
630
                free(indirect);
136
630
                _size -= N + 1;
137
630
            }
138
329k
        } else {
139
215k
            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
210k
            } else {
147
210k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
210k
                assert(new_indirect);
149
210k
                T* src = direct_ptr(0);
150
210k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
210k
                memcpy(dst, src, size() * sizeof(T));
152
210k
                _union.indirect_contents.indirect = new_indirect;
153
210k
                _union.indirect_contents.capacity = new_capacity;
154
210k
                _size += N + 1;
155
210k
            }
156
215k
        }
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
194
    void change_capacity(size_type new_capacity) {
129
194
        if (new_capacity <= N) {
130
194
            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
194
        } 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
194
    }
158
159
175M
    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
148M
    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
8.29M
    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
686k
    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.7M
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<4u, Network, unsigned int, int>::item_ptr(int)
Line
Count
Source
159
456
    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.55k
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
160
1.64G
    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.62G
    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
22.5M
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<8u, int, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
3.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
88.2k
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
161
162
3.24M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
3.24M
        std::fill_n(dst, count, value);
164
3.24M
    }
prevector<36u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
543k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
543k
        std::fill_n(dst, count, value);
164
543k
    }
prevector<33u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
215k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
215k
        std::fill_n(dst, count, value);
164
215k
    }
prevector<16u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
2.46M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
2.46M
        std::fill_n(dst, count, value);
164
2.46M
    }
prevector<8u, int, unsigned int, int>::fill(int*, long, int const&)
Line
Count
Source
162
23.2k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
23.2k
        std::fill_n(dst, count, value);
164
23.2k
    }
165
166
    template <std::input_iterator InputIterator>
167
67.5M
    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
67.5M
    }
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.71M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
85.9M
        while (first != last) {
169
83.2M
            new(static_cast<void*>(dst)) T(*first);
170
83.2M
            ++dst;
171
83.2M
            ++first;
172
83.2M
        }
173
2.71M
    }
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
3.13M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.9M
        while (first != last) {
169
12.8M
            new(static_cast<void*>(dst)) T(*first);
170
12.8M
            ++dst;
171
12.8M
            ++first;
172
12.8M
        }
173
3.13M
    }
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
60.2M
    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
60.2M
    }
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
39.5k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.61M
        while (first != last) {
169
1.57M
            new(static_cast<void*>(dst)) T(*first);
170
1.57M
            ++dst;
171
1.57M
            ++first;
172
1.57M
        }
173
39.5k
    }
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.7k
    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.7k
    }
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.42M
        while (first != last) {
169
2.15M
            new(static_cast<void*>(dst)) T(*first);
170
2.15M
            ++dst;
171
2.15M
            ++first;
172
2.15M
        }
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.42M
        while (first != last) {
169
2.15M
            new(static_cast<void*>(dst)) T(*first);
170
2.15M
            ++dst;
171
2.15M
            ++first;
172
2.15M
        }
173
267k
    }
void prevector<8u, int, unsigned int, int>::fill<int*>(int*, int*, int*)
Line
Count
Source
167
4.04k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
14.0k
        while (first != last) {
169
10.0k
            new(static_cast<void*>(dst)) T(*first);
170
10.0k
            ++dst;
171
10.0k
            ++first;
172
10.0k
        }
173
4.04k
    }
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.22k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
55.7k
        while (first != last) {
169
47.5k
            new(static_cast<void*>(dst)) T(*first);
170
47.5k
            ++dst;
171
47.5k
            ++first;
172
47.5k
        }
173
8.22k
    }
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
195k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
27.3M
        while (first != last) {
169
27.1M
            new(static_cast<void*>(dst)) T(*first);
170
27.1M
            ++dst;
171
27.1M
            ++first;
172
27.1M
        }
173
195k
    }
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.0k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
91.3k
        while (first != last) {
169
81.3k
            new(static_cast<void*>(dst)) T(*first);
170
81.3k
            ++dst;
171
81.3k
            ++first;
172
81.3k
        }
173
10.0k
    }
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
591k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.95M
        while (first != last) {
169
2.36M
            new(static_cast<void*>(dst)) T(*first);
170
2.36M
            ++dst;
171
2.36M
            ++first;
172
2.36M
        }
173
591k
    }
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
194
    void fill(T* dst, InputIterator first, InputIterator last) {
168
6.40k
        while (first != last) {
169
6.20k
            new(static_cast<void*>(dst)) T(*first);
170
6.20k
            ++dst;
171
6.20k
            ++first;
172
6.20k
        }
173
194
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
194
    void fill(T* dst, InputIterator first, InputIterator last) {
168
582
        while (first != last) {
169
388
            new(static_cast<void*>(dst)) T(*first);
170
388
            ++dst;
171
388
            ++first;
172
388
        }
173
194
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
194
    void fill(T* dst, InputIterator first, InputIterator last) {
168
388
        while (first != last) {
169
194
            new(static_cast<void*>(dst)) T(*first);
170
194
            ++dst;
171
194
            ++first;
172
194
        }
173
194
    }
174
175
public:
176
144k
    void assign(size_type n, const T& val) {
177
144k
        clear();
178
144k
        if (capacity() < n) {
179
94.7k
            change_capacity(n);
180
94.7k
        }
181
144k
        _size += n;
182
144k
        fill(item_ptr(0), n, val);
183
144k
    }
prevector<36u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&)
Line
Count
Source
176
143k
    void assign(size_type n, const T& val) {
177
143k
        clear();
178
143k
        if (capacity() < n) {
179
94.6k
            change_capacity(n);
180
94.6k
        }
181
143k
        _size += n;
182
143k
        fill(item_ptr(0), n, val);
183
143k
    }
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
283
    void assign(size_type n, const T& val) {
177
283
        clear();
178
283
        if (capacity() < n) {
179
117
            change_capacity(n);
180
117
        }
181
283
        _size += n;
182
283
        fill(item_ptr(0), n, val);
183
283
    }
184
185
    template <std::input_iterator InputIterator>
186
2.62M
    void assign(InputIterator first, InputIterator last) {
187
2.62M
        size_type n = last - first;
188
2.62M
        clear();
189
2.62M
        if (capacity() < n) {
190
119k
            change_capacity(n);
191
119k
        }
192
2.62M
        _size += n;
193
2.62M
        fill(item_ptr(0), first, last);
194
2.62M
    }
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.97M
    void assign(InputIterator first, InputIterator last) {
187
1.97M
        size_type n = last - first;
188
1.97M
        clear();
189
1.97M
        if (capacity() < n) {
190
118k
            change_capacity(n);
191
118k
        }
192
1.97M
        _size += n;
193
1.97M
        fill(item_ptr(0), first, last);
194
1.97M
    }
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
34.4k
    void assign(InputIterator first, InputIterator last) {
187
34.4k
        size_type n = last - first;
188
34.4k
        clear();
189
34.4k
        if (capacity() < n) {
190
40
            change_capacity(n);
191
40
        }
192
34.4k
        _size += n;
193
34.4k
        fill(item_ptr(0), first, last);
194
34.4k
    }
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.22k
    void assign(InputIterator first, InputIterator last) {
187
8.22k
        size_type n = last - first;
188
8.22k
        clear();
189
8.22k
        if (capacity() < n) {
190
666
            change_capacity(n);
191
666
        }
192
8.22k
        _size += n;
193
8.22k
        fill(item_ptr(0), first, last);
194
8.22k
    }
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.0k
    void assign(InputIterator first, InputIterator last) {
187
10.0k
        size_type n = last - first;
188
10.0k
        clear();
189
10.0k
        if (capacity() < n) {
190
62
            change_capacity(n);
191
62
        }
192
10.0k
        _size += n;
193
10.0k
        fill(item_ptr(0), first, last);
194
10.0k
    }
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
591k
    void assign(InputIterator first, InputIterator last) {
187
591k
        size_type n = last - first;
188
591k
        clear();
189
591k
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
591k
        _size += n;
193
591k
        fill(item_ptr(0), first, last);
194
591k
    }
195
196
92.9M
    prevector() = default;
prevector<36u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
92.4M
    prevector() = default;
prevector<33u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
484k
    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
156
    prevector() = default;
197
198
    explicit prevector(size_type n) {
199
        resize(n);
200
    }
201
202
2.55M
    explicit prevector(size_type n, const T& val) {
203
2.55M
        change_capacity(n);
204
2.55M
        _size += n;
205
2.55M
        fill(item_ptr(0), n, val);
206
2.55M
    }
prevector<33u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
88.2k
    explicit prevector(size_type n, const T& val) {
203
88.2k
        change_capacity(n);
204
88.2k
        _size += n;
205
88.2k
        fill(item_ptr(0), n, val);
206
88.2k
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
2.46M
    explicit prevector(size_type n, const T& val) {
203
2.46M
        change_capacity(n);
204
2.46M
        _size += n;
205
2.46M
        fill(item_ptr(0), n, val);
206
2.46M
    }
207
208
    template <std::input_iterator InputIterator>
209
1.14M
    prevector(InputIterator first, InputIterator last) {
210
1.14M
        size_type n = last - first;
211
1.14M
        change_capacity(n);
212
1.14M
        _size += n;
213
1.14M
        fill(item_ptr(0), first, last);
214
1.14M
    }
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
36.8k
    prevector(InputIterator first, InputIterator last) {
210
36.8k
        size_type n = last - first;
211
36.8k
        change_capacity(n);
212
36.8k
        _size += n;
213
36.8k
        fill(item_ptr(0), first, last);
214
36.8k
    }
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
7.91k
    prevector(InputIterator first, InputIterator last) {
210
7.91k
        size_type n = last - first;
211
7.91k
        change_capacity(n);
212
7.91k
        _size += n;
213
7.91k
        fill(item_ptr(0), first, last);
214
7.91k
    }
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
195k
    prevector(InputIterator first, InputIterator last) {
210
195k
        size_type n = last - first;
211
195k
        change_capacity(n);
212
195k
        _size += n;
213
195k
        fill(item_ptr(0), first, last);
214
195k
    }
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
194
    prevector(InputIterator first, InputIterator last) {
210
194
        size_type n = last - first;
211
194
        change_capacity(n);
212
194
        _size += n;
213
194
        fill(item_ptr(0), first, last);
214
194
    }
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
3.10M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
3.10M
        size_type n = other.size();
218
3.10M
        change_capacity(n);
219
3.10M
        _size += n;
220
3.10M
        fill(item_ptr(0), other.begin(),  other.end());
221
3.10M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
55.1M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
55.1M
        size_type n = other.size();
218
55.1M
        change_capacity(n);
219
55.1M
        _size += n;
220
55.1M
        fill(item_ptr(0), other.begin(),  other.end());
221
55.1M
    }
222
223
    prevector(prevector<N, T, Size, Diff>&& other) noexcept
224
16.5M
        : _union(std::move(other._union)), _size(other._size)
225
16.5M
    {
226
16.5M
        other._size = 0;
227
16.5M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
565k
        : _union(std::move(other._union)), _size(other._size)
225
565k
    {
226
565k
        other._size = 0;
227
565k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
15.9M
        : _union(std::move(other._union)), _size(other._size)
225
15.9M
    {
226
15.9M
        other._size = 0;
227
15.9M
    }
228
229
2.03M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
2.03M
        if (&other == this) {
231
13.0k
            return *this;
232
13.0k
        }
233
2.01M
        assign(other.begin(), other.end());
234
2.01M
        return *this;
235
2.03M
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
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.97M
        assign(other.begin(), other.end());
234
1.97M
        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
34.4k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
34.4k
        if (&other == this) {
231
2
            return *this;
232
2
        }
233
34.4k
        assign(other.begin(), other.end());
234
34.4k
        return *this;
235
34.4k
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int> const&)
Line
Count
Source
229
8.22k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
8.22k
        if (&other == this) {
231
0
            return *this;
232
0
        }
233
8.22k
        assign(other.begin(), other.end());
234
8.22k
        return *this;
235
8.22k
    }
236
237
41.7M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
41.7M
        if (!is_direct()) {
239
22.8k
            free(_union.indirect_contents.indirect);
240
22.8k
        }
241
41.7M
        _union = std::move(other._union);
242
41.7M
        _size = other._size;
243
41.7M
        other._size = 0;
244
41.7M
        return *this;
245
41.7M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
624k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
624k
        if (!is_direct()) {
239
8
            free(_union.indirect_contents.indirect);
240
8
        }
241
624k
        _union = std::move(other._union);
242
624k
        _size = other._size;
243
624k
        other._size = 0;
244
624k
        return *this;
245
624k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
41.1M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
41.1M
        if (!is_direct()) {
239
20.2k
            free(_union.indirect_contents.indirect);
240
20.2k
        }
241
41.1M
        _union = std::move(other._union);
242
41.1M
        _size = other._size;
243
41.1M
        other._size = 0;
244
41.1M
        return *this;
245
41.1M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int>&&)
Line
Count
Source
237
4.10k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
4.10k
        if (!is_direct()) {
239
2.56k
            free(_union.indirect_contents.indirect);
240
2.56k
        }
241
4.10k
        _union = std::move(other._union);
242
4.10k
        _size = other._size;
243
4.10k
        other._size = 0;
244
4.10k
        return *this;
245
4.10k
    }
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
16.3M
    size_type size() const {
248
16.3M
        return is_direct() ? _size : _size - N - 1;
249
16.3M
    }
prevector<33u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
343k
    size_type size() const {
248
343k
        return is_direct() ? _size : _size - N - 1;
249
343k
    }
prevector<8u, int, unsigned int, int>::size() const
Line
Count
Source
247
7.21M
    size_type size() const {
248
7.21M
        return is_direct() ? _size : _size - N - 1;
249
7.21M
    }
prevector<4u, Network, unsigned int, int>::size() const
Line
Count
Source
247
912
    size_type size() const {
248
912
        return is_direct() ? _size : _size - N - 1;
249
912
    }
prevector<35u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.35k
    size_type size() const {
248
1.35k
        return is_direct() ? _size : _size - N - 1;
249
1.35k
    }
250
251
30.4M
    bool empty() const {
252
30.4M
        return size() == 0;
253
30.4M
    }
prevector<36u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
30.0M
    bool empty() const {
252
30.0M
        return size() == 0;
253
30.0M
    }
prevector<16u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
100k
    bool empty() const {
252
100k
        return size() == 0;
253
100k
    }
prevector<8u, int, unsigned int, int>::empty() const
Line
Count
Source
251
267k
    bool empty() const {
252
267k
        return size() == 0;
253
267k
    }
prevector<4u, Network, unsigned int, int>::empty() const
Line
Count
Source
251
156
    bool empty() const {
252
156
        return size() == 0;
253
156
    }
254
255
20.4M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
15.1M
    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.28M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<35u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
388
    iterator begin() { return iterator(item_ptr(0)); }
256
154M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
144M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<16u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
7.65M
    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.4M
    iterator end() { return iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
44.0M
    iterator end() { return iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
1.35M
    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
3.05M
    iterator end() { return iterator(item_ptr(size())); }
prevector<35u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
388
    iterator end() { return iterator(item_ptr(size())); }
258
1.44G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.43G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
3.61M
    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.9M
    size_t capacity() const {
261
18.9M
        if (is_direct()) {
262
13.0M
            return N;
263
13.0M
        } else {
264
5.88M
            return _union.indirect_contents.capacity;
265
5.88M
        }
266
18.9M
    }
prevector<36u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
18.0M
    size_t capacity() const {
261
18.0M
        if (is_direct()) {
262
12.2M
            return N;
263
12.2M
        } else {
264
5.82M
            return _union.indirect_contents.capacity;
265
5.82M
        }
266
18.0M
    }
prevector<16u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
636k
    size_t capacity() const {
261
636k
        if (is_direct()) {
262
636k
            return N;
263
636k
        } else {
264
10
            return _union.indirect_contents.capacity;
265
10
        }
266
636k
    }
prevector<8u, int, unsigned int, int>::capacity() const
Line
Count
Source
260
93.1k
    size_t capacity() const {
261
93.1k
        if (is_direct()) {
262
33.9k
            return N;
263
59.2k
        } else {
264
59.2k
            return _union.indirect_contents.capacity;
265
59.2k
        }
266
93.1k
    }
prevector<4u, Network, unsigned int, int>::capacity() const
Line
Count
Source
260
300
    size_t capacity() const {
261
300
        if (is_direct()) {
262
300
            return N;
263
300
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
300
    }
prevector<33u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
127k
    size_t capacity() const {
261
127k
        if (is_direct()) {
262
127k
            return N;
263
127k
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
127k
    }
prevector<35u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
388
    size_t capacity() const {
261
388
        if (is_direct()) {
262
388
            return N;
263
388
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
388
    }
267
268
10.9M
    T& operator[](size_type pos) {
269
10.9M
        return *item_ptr(pos);
270
10.9M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
1.90M
    T& operator[](size_type pos) {
269
1.90M
        return *item_ptr(pos);
270
1.90M
    }
prevector<33u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
255k
    T& operator[](size_type pos) {
269
255k
        return *item_ptr(pos);
270
255k
    }
prevector<8u, int, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
8.76M
    T& operator[](size_type pos) {
269
8.76M
        return *item_ptr(pos);
270
8.76M
    }
prevector<4u, Network, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
156
    T& operator[](size_type pos) {
269
156
        return *item_ptr(pos);
270
156
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
5.09k
    T& operator[](size_type pos) {
269
5.09k
        return *item_ptr(pos);
270
5.09k
    }
271
272
19.5M
    const T& operator[](size_type pos) const {
273
19.5M
        return *item_ptr(pos);
274
19.5M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
11.0M
    const T& operator[](size_type pos) const {
273
11.0M
        return *item_ptr(pos);
274
11.0M
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
8.57M
    const T& operator[](size_type pos) const {
273
8.57M
        return *item_ptr(pos);
274
8.57M
    }
275
276
95.4M
    void resize(size_type new_size) {
277
95.4M
        size_type cur_size = size();
278
95.4M
        if (cur_size == new_size) {
279
79.6M
            return;
280
79.6M
        }
281
15.7M
        if (cur_size > new_size) {
282
15.2M
            erase(item_ptr(new_size), end());
283
15.2M
            return;
284
15.2M
        }
285
533k
        if (new_size > capacity()) {
286
85.6k
            change_capacity(new_size);
287
85.6k
        }
288
533k
        ptrdiff_t increase = new_size - cur_size;
289
533k
        fill(item_ptr(cur_size), increase);
290
533k
        _size += increase;
291
533k
    }
prevector<36u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
94.6M
    void resize(size_type new_size) {
277
94.6M
        size_type cur_size = size();
278
94.6M
        if (cur_size == new_size) {
279
79.6M
            return;
280
79.6M
        }
281
14.9M
        if (cur_size > new_size) {
282
14.5M
            erase(item_ptr(new_size), end());
283
14.5M
            return;
284
14.5M
        }
285
399k
        if (new_size > capacity()) {
286
85.0k
            change_capacity(new_size);
287
85.0k
        }
288
399k
        ptrdiff_t increase = new_size - cur_size;
289
399k
        fill(item_ptr(cur_size), increase);
290
399k
        _size += increase;
291
399k
    }
prevector<16u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
678k
    void resize(size_type new_size) {
277
678k
        size_type cur_size = size();
278
678k
        if (cur_size == new_size) {
279
103
            return;
280
103
        }
281
678k
        if (cur_size > new_size) {
282
678k
            erase(item_ptr(new_size), end());
283
678k
            return;
284
678k
        }
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.1k
    void resize(size_type new_size) {
277
29.1k
        size_type cur_size = size();
278
29.1k
        if (cur_size == new_size) {
279
10.3k
            return;
280
10.3k
        }
281
18.7k
        if (cur_size > new_size) {
282
12.2k
            erase(item_ptr(new_size), end());
283
12.2k
            return;
284
12.2k
        }
285
6.53k
        if (new_size > capacity()) {
286
305
            change_capacity(new_size);
287
305
        }
288
6.53k
        ptrdiff_t increase = new_size - cur_size;
289
6.53k
        fill(item_ptr(cur_size), increase);
290
6.53k
        _size += increase;
291
6.53k
    }
prevector<33u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
127k
    void resize(size_type new_size) {
277
127k
        size_type cur_size = size();
278
127k
        if (cur_size == new_size) {
279
0
            return;
280
0
        }
281
127k
        if (cur_size > new_size) {
282
0
            erase(item_ptr(new_size), end());
283
0
            return;
284
0
        }
285
127k
        if (new_size > capacity()) {
286
0
            change_capacity(new_size);
287
0
        }
288
127k
        ptrdiff_t increase = new_size - cur_size;
289
127k
        fill(item_ptr(cur_size), increase);
290
127k
        _size += increase;
291
127k
    }
292
293
4.16k
    void reserve(size_type new_capacity) {
294
4.16k
        if (new_capacity > capacity()) {
295
1.80k
            change_capacity(new_capacity);
296
1.80k
        }
297
4.16k
    }
298
299
90.9M
    void shrink_to_fit() {
300
90.9M
        change_capacity(size());
301
90.9M
    }
prevector<36u, unsigned char, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
90.9M
    void shrink_to_fit() {
300
90.9M
        change_capacity(size());
301
90.9M
    }
prevector<8u, int, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
2.10k
    void shrink_to_fit() {
300
2.10k
        change_capacity(size());
301
2.10k
    }
302
303
94.8M
    void clear() {
304
94.8M
        resize(0);
305
94.8M
    }
prevector<36u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
94.2M
    void clear() {
304
94.2M
        resize(0);
305
94.2M
    }
prevector<16u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
636k
    void clear() {
304
636k
        resize(0);
305
636k
    }
prevector<8u, int, unsigned int, int>::clear()
Line
Count
Source
303
12.7k
    void clear() {
304
12.7k
        resize(0);
305
12.7k
    }
306
307
9.02M
    iterator insert(iterator pos, const T& value) {
308
9.02M
        size_type p = pos - begin();
309
9.02M
        size_type new_size = size() + 1;
310
9.02M
        if (capacity() < new_size) {
311
8.09k
            change_capacity(new_size + (new_size >> 1));
312
8.09k
        }
313
9.02M
        T* ptr = item_ptr(p);
314
9.02M
        T* dst = ptr + 1;
315
9.02M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.02M
        _size++;
317
9.02M
        new(static_cast<void*>(ptr)) T(value);
318
9.02M
        return iterator(ptr);
319
9.02M
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const&)
Line
Count
Source
307
8.99M
    iterator insert(iterator pos, const T& value) {
308
8.99M
        size_type p = pos - begin();
309
8.99M
        size_type new_size = size() + 1;
310
8.99M
        if (capacity() < new_size) {
311
6.65k
            change_capacity(new_size + (new_size >> 1));
312
6.65k
        }
313
8.99M
        T* ptr = item_ptr(p);
314
8.99M
        T* dst = ptr + 1;
315
8.99M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
8.99M
        _size++;
317
8.99M
        new(static_cast<void*>(ptr)) T(value);
318
8.99M
        return iterator(ptr);
319
8.99M
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, int const&)
Line
Count
Source
307
32.7k
    iterator insert(iterator pos, const T& value) {
308
32.7k
        size_type p = pos - begin();
309
32.7k
        size_type new_size = size() + 1;
310
32.7k
        if (capacity() < new_size) {
311
1.43k
            change_capacity(new_size + (new_size >> 1));
312
1.43k
        }
313
32.7k
        T* ptr = item_ptr(p);
314
32.7k
        T* dst = ptr + 1;
315
32.7k
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
32.7k
        _size++;
317
32.7k
        new(static_cast<void*>(ptr)) T(value);
318
32.7k
        return iterator(ptr);
319
32.7k
    }
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
859
            change_capacity(new_size + (new_size >> 1));
326
859
        }
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
852
            change_capacity(new_size + (new_size >> 1));
326
852
        }
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.49M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
5.49M
        size_type p = pos - begin();
337
5.49M
        difference_type count = last - first;
338
5.49M
        size_type new_size = size() + count;
339
5.49M
        if (capacity() < new_size) {
340
369k
            change_capacity(new_size + (new_size >> 1));
341
369k
        }
342
5.49M
        T* ptr = item_ptr(p);
343
5.49M
        T* dst = ptr + count;
344
5.49M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
5.49M
        _size += count;
346
5.49M
        fill(ptr, first, last);
347
5.49M
    }
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.70M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.70M
        size_type p = pos - begin();
337
2.70M
        difference_type count = last - first;
338
2.70M
        size_type new_size = size() + count;
339
2.70M
        if (capacity() < new_size) {
340
224k
            change_capacity(new_size + (new_size >> 1));
341
224k
        }
342
2.70M
        T* ptr = item_ptr(p);
343
2.70M
        T* dst = ptr + count;
344
2.70M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.70M
        _size += count;
346
2.70M
        fill(ptr, first, last);
347
2.70M
    }
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.7k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
22.7k
        size_type p = pos - begin();
337
22.7k
        difference_type count = last - first;
338
22.7k
        size_type new_size = size() + count;
339
22.7k
        if (capacity() < new_size) {
340
17.0k
            change_capacity(new_size + (new_size >> 1));
341
17.0k
        }
342
22.7k
        T* ptr = item_ptr(p);
343
22.7k
        T* dst = ptr + count;
344
22.7k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
22.7k
        _size += count;
346
22.7k
        fill(ptr, first, last);
347
22.7k
    }
void prevector<8u, int, unsigned int, int>::insert<int*>(prevector<8u, int, unsigned int, int>::iterator, int*, int*)
Line
Count
Source
335
4.04k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
4.04k
        size_type p = pos - begin();
337
4.04k
        difference_type count = last - first;
338
4.04k
        size_type new_size = size() + count;
339
4.04k
        if (capacity() < new_size) {
340
294
            change_capacity(new_size + (new_size >> 1));
341
294
        }
342
4.04k
        T* ptr = item_ptr(p);
343
4.04k
        T* dst = ptr + count;
344
4.04k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
4.04k
        _size += count;
346
4.04k
        fill(ptr, first, last);
347
4.04k
    }
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.74k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.74k
        size_type p = pos - begin();
337
2.74k
        difference_type count = last - first;
338
2.74k
        size_type new_size = size() + count;
339
2.74k
        if (capacity() < new_size) {
340
238
            change_capacity(new_size + (new_size >> 1));
341
238
        }
342
2.74k
        T* ptr = item_ptr(p);
343
2.74k
        T* dst = ptr + count;
344
2.74k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.74k
        _size += count;
346
2.74k
        fill(ptr, first, last);
347
2.74k
    }
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.76M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.76M
        size_type p = pos - begin();
337
2.76M
        difference_type count = last - first;
338
2.76M
        size_type new_size = size() + count;
339
2.76M
        if (capacity() < new_size) {
340
127k
            change_capacity(new_size + (new_size >> 1));
341
127k
        }
342
2.76M
        T* ptr = item_ptr(p);
343
2.76M
        T* dst = ptr + count;
344
2.76M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.76M
        _size += count;
346
2.76M
        fill(ptr, first, last);
347
2.76M
    }
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
194
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
194
        size_type p = pos - begin();
337
194
        difference_type count = last - first;
338
194
        size_type new_size = size() + count;
339
194
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
194
        T* ptr = item_ptr(p);
343
194
        T* dst = ptr + count;
344
194
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
194
        _size += count;
346
194
        fill(ptr, first, last);
347
194
    }
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
194
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
194
        size_type p = pos - begin();
337
194
        difference_type count = last - first;
338
194
        size_type new_size = size() + count;
339
194
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
194
        T* ptr = item_ptr(p);
343
194
        T* dst = ptr + count;
344
194
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
194
        _size += count;
346
194
        fill(ptr, first, last);
347
194
    }
348
349
987k
    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
987k
        if (capacity() < new_size) {
353
219k
            change_capacity(new_size);
354
219k
            _size += new_size - size();
355
219k
            return;
356
219k
        }
357
767k
        if (new_size < size()) {
358
3.27k
            erase(item_ptr(new_size), end());
359
764k
        } else {
360
764k
            _size += new_size - size();
361
764k
        }
362
767k
    }
prevector<36u, unsigned char, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
979k
    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
979k
        if (capacity() < new_size) {
353
218k
            change_capacity(new_size);
354
218k
            _size += new_size - size();
355
218k
            return;
356
218k
        }
357
760k
        if (new_size < size()) {
358
0
            erase(item_ptr(new_size), end());
359
760k
        } else {
360
760k
            _size += new_size - size();
361
760k
        }
362
760k
    }
prevector<8u, int, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
8.34k
    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.34k
        if (capacity() < new_size) {
353
1.20k
            change_capacity(new_size);
354
1.20k
            _size += new_size - size();
355
1.20k
            return;
356
1.20k
        }
357
7.13k
        if (new_size < size()) {
358
3.27k
            erase(item_ptr(new_size), end());
359
3.85k
        } else {
360
3.85k
            _size += new_size - size();
361
3.85k
        }
362
7.13k
    }
363
364
28.0k
    iterator erase(iterator pos) {
365
28.0k
        return erase(pos, pos + 1);
366
28.0k
    }
367
368
15.3M
    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.3M
        iterator p = first;
376
15.3M
        char* endp = (char*)&(*end());
377
15.3M
        _size -= last - p;
378
15.3M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
15.3M
        return first;
380
15.3M
    }
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
14.5M
    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
14.5M
        iterator p = first;
376
14.5M
        char* endp = (char*)&(*end());
377
14.5M
        _size -= last - p;
378
14.5M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
14.5M
        return first;
380
14.5M
    }
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
678k
    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
678k
        iterator p = first;
376
678k
        char* endp = (char*)&(*end());
377
678k
        _size -= last - p;
378
678k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
678k
        return first;
380
678k
    }
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.8k
    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.8k
        iterator p = first;
376
70.8k
        char* endp = (char*)&(*end());
377
70.8k
        _size -= last - p;
378
70.8k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
70.8k
        return first;
380
70.8k
    }
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.1k
    void emplace_back(Args&&... args) {
384
81.1k
        size_type new_size = size() + 1;
385
81.1k
        if (capacity() < new_size) {
386
13.2k
            change_capacity(new_size + (new_size >> 1));
387
13.2k
        }
388
81.1k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
81.1k
        _size++;
390
81.1k
    }
void prevector<36u, unsigned char, unsigned int, int>::emplace_back<unsigned char const&>(unsigned char const&)
Line
Count
Source
383
72.5k
    void emplace_back(Args&&... args) {
384
72.5k
        size_type new_size = size() + 1;
385
72.5k
        if (capacity() < new_size) {
386
13.0k
            change_capacity(new_size + (new_size >> 1));
387
13.0k
        }
388
72.5k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
72.5k
        _size++;
390
72.5k
    }
void prevector<8u, int, unsigned int, int>::emplace_back<int const&>(int const&)
Line
Count
Source
383
8.29k
    void emplace_back(Args&&... args) {
384
8.29k
        size_type new_size = size() + 1;
385
8.29k
        if (capacity() < new_size) {
386
242
            change_capacity(new_size + (new_size >> 1));
387
242
        }
388
8.29k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
8.29k
        _size++;
390
8.29k
    }
void prevector<4u, Network, unsigned int, int>::emplace_back<Network const&>(Network const&)
Line
Count
Source
383
300
    void emplace_back(Args&&... args) {
384
300
        size_type new_size = size() + 1;
385
300
        if (capacity() < new_size) {
386
0
            change_capacity(new_size + (new_size >> 1));
387
0
        }
388
300
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
300
        _size++;
390
300
    }
391
392
81.1k
    void push_back(const T& value) {
393
81.1k
        emplace_back(value);
394
81.1k
    }
prevector<36u, unsigned char, unsigned int, int>::push_back(unsigned char const&)
Line
Count
Source
392
72.5k
    void push_back(const T& value) {
393
72.5k
        emplace_back(value);
394
72.5k
    }
prevector<8u, int, unsigned int, int>::push_back(int const&)
Line
Count
Source
392
8.29k
    void push_back(const T& value) {
393
8.29k
        emplace_back(value);
394
8.29k
    }
prevector<4u, Network, unsigned int, int>::push_back(Network const&)
Line
Count
Source
392
300
    void push_back(const T& value) {
393
300
        emplace_back(value);
394
300
    }
395
396
6.76k
    void pop_back() {
397
6.76k
        erase(end() - 1, end());
398
6.76k
    }
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.6k
    const T& back() const {
413
27.6k
        return *item_ptr(size() - 1);
414
27.6k
    }
415
416
    void swap(prevector<N, T, Size, Diff>& other) noexcept
417
16.3k
    {
418
16.3k
        std::swap(_union, other._union);
419
16.3k
        std::swap(_size, other._size);
420
16.3k
    }
421
422
171M
    ~prevector() {
423
171M
        if (!is_direct()) {
424
2.28M
            free(_union.indirect_contents.indirect);
425
2.28M
            _union.indirect_contents.indirect = nullptr;
426
2.28M
        }
427
171M
    }
prevector<16u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
6.11M
    ~prevector() {
423
6.11M
        if (!is_direct()) {
424
2.09k
            free(_union.indirect_contents.indirect);
425
2.09k
            _union.indirect_contents.indirect = nullptr;
426
2.09k
        }
427
6.11M
    }
prevector<36u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
164M
    ~prevector() {
423
164M
        if (!is_direct()) {
424
2.07M
            free(_union.indirect_contents.indirect);
425
2.07M
            _union.indirect_contents.indirect = nullptr;
426
2.07M
        }
427
164M
    }
prevector<33u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
572k
    ~prevector() {
423
572k
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
572k
    }
prevector<8u, int, unsigned int, int>::~prevector()
Line
Count
Source
422
535k
    ~prevector() {
423
535k
        if (!is_direct()) {
424
207k
            free(_union.indirect_contents.indirect);
425
207k
            _union.indirect_contents.indirect = nullptr;
426
207k
        }
427
535k
    }
prevector<4u, Network, unsigned int, int>::~prevector()
Line
Count
Source
422
156
    ~prevector() {
423
156
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
156
    }
prevector<35u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
194
    ~prevector() {
423
194
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
194
    }
428
429
6.56M
    constexpr bool operator==(const prevector& other) const {
430
6.56M
        return std::ranges::equal(*this, other);
431
6.56M
    }
prevector<36u, unsigned char, unsigned int, int>::operator==(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
5.80M
    constexpr bool operator==(const prevector& other) const {
430
5.80M
        return std::ranges::equal(*this, other);
431
5.80M
    }
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
219k
    constexpr bool operator==(const prevector& other) const {
430
219k
        return std::ranges::equal(*this, other);
431
219k
    }
432
433
21.8M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.8M
        if (size() < other.size()) {
435
756k
            return true;
436
756k
        }
437
21.1M
        if (size() > other.size()) {
438
279k
            return false;
439
279k
        }
440
20.8M
        const_iterator b1 = begin();
441
20.8M
        const_iterator b2 = other.begin();
442
20.8M
        const_iterator e1 = end();
443
135M
        while (b1 != e1) {
444
132M
            if ((*b1) < (*b2)) {
445
10.2M
                return true;
446
10.2M
            }
447
122M
            if ((*b2) < (*b1)) {
448
7.80M
                return false;
449
7.80M
            }
450
114M
            ++b1;
451
114M
            ++b2;
452
114M
        }
453
2.75M
        return false;
454
20.8M
    }
prevector<36u, unsigned char, unsigned int, int>::operator<(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
21.8M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.8M
        if (size() < other.size()) {
435
756k
            return true;
436
756k
        }
437
21.0M
        if (size() > other.size()) {
438
279k
            return false;
439
279k
        }
440
20.8M
        const_iterator b1 = begin();
441
20.8M
        const_iterator b2 = other.begin();
442
20.8M
        const_iterator e1 = end();
443
135M
        while (b1 != e1) {
444
132M
            if ((*b1) < (*b2)) {
445
10.2M
                return true;
446
10.2M
            }
447
122M
            if ((*b2) < (*b1)) {
448
7.80M
                return false;
449
7.80M
            }
450
114M
            ++b1;
451
114M
            ++b2;
452
114M
        }
453
2.73M
        return false;
454
20.8M
    }
prevector<16u, unsigned char, unsigned int, int>::operator<(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
28.6k
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
28.6k
        if (size() < other.size()) {
435
0
            return true;
436
0
        }
437
28.6k
        if (size() > other.size()) {
438
0
            return false;
439
0
        }
440
28.6k
        const_iterator b1 = begin();
441
28.6k
        const_iterator b2 = other.begin();
442
28.6k
        const_iterator e1 = end();
443
143k
        while (b1 != e1) {
444
115k
            if ((*b1) < (*b2)) {
445
259
                return true;
446
259
            }
447
115k
            if ((*b2) < (*b1)) {
448
82
                return false;
449
82
            }
450
115k
            ++b1;
451
115k
            ++b2;
452
115k
        }
453
28.2k
        return false;
454
28.6k
    }
455
456
55.1M
    size_t allocated_memory() const {
457
55.1M
        if (is_direct()) {
458
54.2M
            return 0;
459
54.2M
        } else {
460
909k
            return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity;
461
909k
        }
462
55.1M
    }
463
464
564k
    value_type* data() {
465
564k
        return item_ptr(0);
466
564k
    }
prevector<16u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
42.0k
    value_type* data() {
465
42.0k
        return item_ptr(0);
466
42.0k
    }
prevector<33u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
215k
    value_type* data() {
465
215k
        return item_ptr(0);
466
215k
    }
prevector<36u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
306k
    value_type* data() {
465
306k
        return item_ptr(0);
466
306k
    }
prevector<35u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
194
    value_type* data() {
465
194
        return item_ptr(0);
466
194
    }
467
468
30.9M
    const value_type* data() const {
469
30.9M
        return item_ptr(0);
470
30.9M
    }
prevector<36u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
28.0M
    const value_type* data() const {
469
28.0M
        return item_ptr(0);
470
28.0M
    }
prevector<16u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
2.73M
    const value_type* data() const {
469
2.73M
        return item_ptr(0);
470
2.73M
    }
prevector<33u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
88.2k
    const value_type* data() const {
469
88.2k
        return item_ptr(0);
470
88.2k
    }
471
};
472
473
#endif // BITCOIN_PREVECTOR_H