Coverage Report

Created: 2026-04-29 19:21

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 <cstddef>
11
#include <cstdint>
12
#include <cstdlib>
13
#include <cstring>
14
#include <iterator>
15
#include <type_traits>
16
#include <utility>
17
18
/** Implements a drop-in replacement for std::vector<T> which stores up to N
19
 *  elements directly (without heap allocation). The types Size and Diff are
20
 *  used to store element counts, and can be any unsigned + signed type.
21
 *
22
 *  Storage layout is either:
23
 *  - Direct allocation:
24
 *    - Size _size: the number of used elements (between 0 and N)
25
 *    - T direct[N]: an array of N elements of type T
26
 *      (only the first _size are initialized).
27
 *  - Indirect allocation:
28
 *    - Size _size: the number of used elements plus N + 1
29
 *    - Size capacity: the number of allocated elements
30
 *    - T* indirect: a pointer to an array of capacity elements of type T
31
 *      (only the first _size are initialized).
32
 *
33
 *  The data type T must be movable by memmove/realloc(). Once we switch to C++,
34
 *  move constructors can be used instead.
35
 */
36
template<unsigned int N, typename T, typename Size = uint32_t, typename Diff = int32_t>
37
class prevector {
38
    static_assert(std::is_trivially_copyable_v<T>);
39
40
public:
41
    static constexpr unsigned int STATIC_SIZE{N};
42
43
    typedef Size size_type;
44
    typedef Diff difference_type;
45
    typedef T value_type;
46
    typedef value_type& reference;
47
    typedef const value_type& const_reference;
48
    typedef value_type* pointer;
49
    typedef const value_type* const_pointer;
50
51
    class iterator {
52
        T* ptr{};
53
    public:
54
        typedef Diff difference_type;
55
        typedef T* pointer;
56
        typedef T& reference;
57
        using element_type = T;
58
        using iterator_category = std::contiguous_iterator_tag;
59
        iterator() = default;
60
97.1M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
80.1M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
1.95M
        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
788
        iterator(T* ptr_) : ptr(ptr_) {}
61
165M
        T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
149M
        T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
3.91M
        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
788
        T& operator*() const { return *ptr; }
62
35.3k
        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.3k
        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.31M
        iterator& operator++() { ptr++; return *this; }
65
4.31M
        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
29.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
28.2M
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<16u, unsigned char, unsigned int, int>::iterator, prevector<16u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
68
652k
        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
394k
        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
394
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
69
4.47M
        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.28M
        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.58G
        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.0M
        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.56G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::const_iterator::const_iterator(int const*)
Line
Count
Source
87
3.78M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
88
738k
        const_iterator(iterator x) : ptr(&(*x)) {}
89
18.1G
        const T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
18.1G
        const T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
19.1M
        const T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
17.3M
        const T& operator*() const { return *ptr; }
90
3.89M
        const T* operator->() const { return ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
478
        const T* operator->() const { return ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
3.89M
        const T* operator->() const { return ptr; }
91
180k
        const T& operator[](size_type pos) const { return ptr[pos]; }
92
16.3G
        const_iterator& operator++() { ptr++; return *this; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
16.3G
        const_iterator& operator++() { ptr++; return *this; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
13.7M
        const_iterator& operator++() { ptr++; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
13.0M
        const_iterator& operator++() { ptr++; return *this; }
93
4.31M
        const_iterator& operator--() { ptr--; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator--()
Line
Count
Source
93
4.31M
        const_iterator& operator--() { ptr--; return *this; }
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator--()
94
683M
        const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
95
        const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
96
732M
        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
730M
        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
473k
        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.08M
        difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
97
6.05M
        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.44M
        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.6G
        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.5G
        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.3M
        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.2M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
103
1.36G
        auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<16u, unsigned char, unsigned int, int>::const_iterator) const
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<36u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
103
1.36G
        auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; }
Unexecuted instantiation: prevector<8u, int, unsigned int, int>::const_iterator::operator<=>(prevector<8u, int, unsigned int, int>::const_iterator) const
104
    };
105
106
private:
107
#pragma pack(push, 1)
108
    union direct_or_indirect {
109
        char direct[sizeof(T) * N];
110
        struct {
111
            char* indirect;
112
            size_type capacity;
113
        } indirect_contents;
114
    };
115
#pragma pack(pop)
116
    alignas(char*) direct_or_indirect _union = {};
117
    size_type _size = 0;
118
119
    static_assert(alignof(char*) % alignof(size_type) == 0 && sizeof(char*) % alignof(size_type) == 0, "size_type cannot have more restrictive alignment requirement than pointer");
120
    static_assert(alignof(char*) % alignof(T) == 0, "value_type T cannot have more restrictive alignment requirement than pointer");
121
122
127M
    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
116M
    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
7.98M
    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
679k
    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
61
    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.57k
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
123
284M
    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
260M
    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.2M
    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.55M
    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
85.7k
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
124
35.6M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
20.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.28k
    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.34G
    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
5.67k
    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.22M
    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.17G
    bool is_direct() const { return _size <= N; }
prevector<36u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.08G
    bool is_direct() const { return _size <= N; }
prevector<16u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
58.6M
    bool is_direct() const { return _size <= N; }
prevector<33u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
1.88M
    bool is_direct() const { return _size <= N; }
prevector<8u, int, unsigned int, int>::is_direct() const
Line
Count
Source
126
30.0M
    bool is_direct() const { return _size <= N; }
prevector<4u, Network, unsigned int, int>::is_direct() const
Line
Count
Source
126
244
    bool is_direct() const { return _size <= N; }
prevector<35u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.74k
    bool is_direct() const { return _size <= N; }
127
128
142M
    void change_capacity(size_type new_capacity) {
129
142M
        if (new_capacity <= N) {
130
139M
            if (!is_direct()) {
131
45.1k
                T* indirect = indirect_ptr(0);
132
45.1k
                T* src = indirect;
133
45.1k
                T* dst = direct_ptr(0);
134
45.1k
                memcpy(dst, src, size() * sizeof(T));
135
45.1k
                free(indirect);
136
45.1k
                _size -= N + 1;
137
45.1k
            }
138
139M
        } else {
139
2.41M
            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.0k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
83.0k
                assert(_union.indirect_contents.indirect);
145
83.0k
                _union.indirect_contents.capacity = new_capacity;
146
2.33M
            } else {
147
2.33M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.33M
                assert(new_indirect);
149
2.33M
                T* src = direct_ptr(0);
150
2.33M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.33M
                memcpy(dst, src, size() * sizeof(T));
152
2.33M
                _union.indirect_contents.indirect = new_indirect;
153
2.33M
                _union.indirect_contents.capacity = new_capacity;
154
2.33M
                _size += N + 1;
155
2.33M
            }
156
2.41M
        }
157
142M
    }
prevector<36u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
136M
    void change_capacity(size_type new_capacity) {
129
136M
        if (new_capacity <= N) {
130
134M
            if (!is_direct()) {
131
44.5k
                T* indirect = indirect_ptr(0);
132
44.5k
                T* src = indirect;
133
44.5k
                T* dst = direct_ptr(0);
134
44.5k
                memcpy(dst, src, size() * sizeof(T));
135
44.5k
                free(indirect);
136
44.5k
                _size -= N + 1;
137
44.5k
            }
138
134M
        } else {
139
2.19M
            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.7k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
78.7k
                assert(_union.indirect_contents.indirect);
145
78.7k
                _union.indirect_contents.capacity = new_capacity;
146
2.11M
            } else {
147
2.11M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.11M
                assert(new_indirect);
149
2.11M
                T* src = direct_ptr(0);
150
2.11M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.11M
                memcpy(dst, src, size() * sizeof(T));
152
2.11M
                _union.indirect_contents.indirect = new_indirect;
153
2.11M
                _union.indirect_contents.capacity = new_capacity;
154
2.11M
                _size += N + 1;
155
2.11M
            }
156
2.19M
        }
157
136M
    }
prevector<16u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
5.36M
    void change_capacity(size_type new_capacity) {
129
5.36M
        if (new_capacity <= N) {
130
5.36M
            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.36M
        } else {
139
1.95k
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
0
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
0
                assert(_union.indirect_contents.indirect);
145
0
                _union.indirect_contents.capacity = new_capacity;
146
1.95k
            } else {
147
1.95k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
1.95k
                assert(new_indirect);
149
1.95k
                T* src = direct_ptr(0);
150
1.95k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
1.95k
                memcpy(dst, src, size() * sizeof(T));
152
1.95k
                _union.indirect_contents.indirect = new_indirect;
153
1.95k
                _union.indirect_contents.capacity = new_capacity;
154
1.95k
                _size += N + 1;
155
1.95k
            }
156
1.95k
        }
157
5.36M
    }
prevector<33u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
85.7k
    void change_capacity(size_type new_capacity) {
129
85.7k
        if (new_capacity <= N) {
130
85.7k
            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
85.7k
        } 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
85.7k
    }
prevector<8u, int, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
547k
    void change_capacity(size_type new_capacity) {
129
547k
        if (new_capacity <= N) {
130
332k
            if (!is_direct()) {
131
596
                T* indirect = indirect_ptr(0);
132
596
                T* src = indirect;
133
596
                T* dst = direct_ptr(0);
134
596
                memcpy(dst, src, size() * sizeof(T));
135
596
                free(indirect);
136
596
                _size -= N + 1;
137
596
            }
138
332k
        } else {
139
214k
            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.28k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
4.28k
                assert(_union.indirect_contents.indirect);
145
4.28k
                _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
214k
        }
157
547k
    }
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
197
    void change_capacity(size_type new_capacity) {
129
197
        if (new_capacity <= N) {
130
197
            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
197
        } 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
197
    }
158
159
160M
    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
134M
    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
7.98M
    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
679k
    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.8M
    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
61
    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.57k
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
160
1.62G
    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.59G
    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.2M
    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.78M
    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
85.7k
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
161
162
3.12M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
3.12M
        std::fill_n(dst, count, value);
164
3.12M
    }
prevector<36u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
529k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
529k
        std::fill_n(dst, count, value);
164
529k
    }
prevector<33u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
212k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
212k
        std::fill_n(dst, count, value);
164
212k
    }
prevector<16u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
2.36M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
2.36M
        std::fill_n(dst, count, value);
164
2.36M
    }
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
55.8M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.5G
        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
55.8M
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
393
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.42k
        while (first != last) {
169
1.02k
            new(static_cast<void*>(dst)) T(*first);
170
1.02k
            ++dst;
171
1.02k
            ++first;
172
1.02k
        }
173
393
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
167
2.69M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
86.5M
        while (first != last) {
169
83.8M
            new(static_cast<void*>(dst)) T(*first);
170
83.8M
            ++dst;
171
83.8M
            ++first;
172
83.8M
        }
173
2.69M
    }
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.04M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.4M
        while (first != last) {
169
12.4M
            new(static_cast<void*>(dst)) T(*first);
170
12.4M
            ++dst;
171
12.4M
            ++first;
172
12.4M
        }
173
3.04M
    }
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
48.7M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.3G
        while (first != last) {
169
15.3G
            new(static_cast<void*>(dst)) T(*first);
170
15.3G
            ++dst;
171
15.3G
            ++first;
172
15.3G
        }
173
48.7M
    }
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.8k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.62M
        while (first != last) {
169
1.58M
            new(static_cast<void*>(dst)) T(*first);
170
1.58M
            ++dst;
171
1.58M
            ++first;
172
1.58M
        }
173
39.8k
    }
void prevector<33u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
1
    void fill(T* dst, InputIterator first, InputIterator last) {
168
33
        while (first != last) {
169
32
            new(static_cast<void*>(dst)) T(*first);
170
32
            ++dst;
171
32
            ++first;
172
32
        }
173
1
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<prevector<36u, unsigned char, unsigned int, int>::iterator>(unsigned char*, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
167
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
269k
    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
269k
    }
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
269k
    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
269k
    }
void prevector<8u, int, unsigned int, int>::fill<int*>(int*, int*, int*)
Line
Count
Source
167
4.18k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
14.7k
        while (first != last) {
169
10.5k
            new(static_cast<void*>(dst)) T(*first);
170
10.5k
            ++dst;
171
10.5k
            ++first;
172
10.5k
        }
173
4.18k
    }
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.26k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
58.6k
        while (first != last) {
169
50.4k
            new(static_cast<void*>(dst)) T(*first);
170
50.4k
            ++dst;
171
50.4k
            ++first;
172
50.4k
        }
173
8.26k
    }
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
28.3M
        while (first != last) {
169
28.2M
            new(static_cast<void*>(dst)) T(*first);
170
28.2M
            ++dst;
171
28.2M
            ++first;
172
28.2M
        }
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
9.95k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
90.2k
        while (first != last) {
169
80.2k
            new(static_cast<void*>(dst)) T(*first);
170
80.2k
            ++dst;
171
80.2k
            ++first;
172
80.2k
        }
173
9.95k
    }
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
567k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.83M
        while (first != last) {
169
2.26M
            new(static_cast<void*>(dst)) T(*first);
170
2.26M
            ++dst;
171
2.26M
            ++first;
172
2.26M
        }
173
567k
    }
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
197
    void fill(T* dst, InputIterator first, InputIterator last) {
168
6.50k
        while (first != last) {
169
6.30k
            new(static_cast<void*>(dst)) T(*first);
170
6.30k
            ++dst;
171
6.30k
            ++first;
172
6.30k
        }
173
197
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
197
    void fill(T* dst, InputIterator first, InputIterator last) {
168
591
        while (first != last) {
169
394
            new(static_cast<void*>(dst)) T(*first);
170
394
            ++dst;
171
394
            ++first;
172
394
        }
173
197
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
197
    void fill(T* dst, InputIterator first, InputIterator last) {
168
394
        while (first != last) {
169
197
            new(static_cast<void*>(dst)) T(*first);
170
197
            ++dst;
171
197
            ++first;
172
197
        }
173
197
    }
174
175
public:
176
144k
    void assign(size_type n, const T& val) {
177
144k
        clear();
178
144k
        if (capacity() < n) {
179
94.8k
            change_capacity(n);
180
94.8k
        }
181
144k
        _size += n;
182
144k
        fill(item_ptr(0), n, val);
183
144k
    }
prevector<36u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&)
Line
Count
Source
176
144k
    void assign(size_type n, const T& val) {
177
144k
        clear();
178
144k
        if (capacity() < n) {
179
94.7k
            change_capacity(n);
180
94.7k
        }
181
144k
        _size += n;
182
144k
        fill(item_ptr(0), n, val);
183
144k
    }
prevector<16u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&)
Line
Count
Source
176
6
    void assign(size_type n, const T& val) {
177
6
        clear();
178
6
        if (capacity() < n) {
179
0
            change_capacity(n);
180
0
        }
181
6
        _size += n;
182
6
        fill(item_ptr(0), n, val);
183
6
    }
prevector<8u, int, unsigned int, int>::assign(unsigned int, int const&)
Line
Count
Source
176
246
    void assign(size_type n, const T& val) {
177
246
        clear();
178
246
        if (capacity() < n) {
179
101
            change_capacity(n);
180
101
        }
181
246
        _size += n;
182
246
        fill(item_ptr(0), n, val);
183
246
    }
184
185
    template <std::input_iterator InputIterator>
186
1.60M
    void assign(InputIterator first, InputIterator last) {
187
1.60M
        size_type n = last - first;
188
1.60M
        clear();
189
1.60M
        if (capacity() < n) {
190
118k
            change_capacity(n);
191
118k
        }
192
1.60M
        _size += n;
193
1.60M
        fill(item_ptr(0), first, last);
194
1.60M
    }
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
981k
    void assign(InputIterator first, InputIterator last) {
187
981k
        size_type n = last - first;
188
981k
        clear();
189
981k
        if (capacity() < n) {
190
117k
            change_capacity(n);
191
117k
        }
192
981k
        _size += n;
193
981k
        fill(item_ptr(0), first, last);
194
981k
    }
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
33.9k
    void assign(InputIterator first, InputIterator last) {
187
33.9k
        size_type n = last - first;
188
33.9k
        clear();
189
33.9k
        if (capacity() < n) {
190
31
            change_capacity(n);
191
31
        }
192
33.9k
        _size += n;
193
33.9k
        fill(item_ptr(0), first, last);
194
33.9k
    }
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.26k
    void assign(InputIterator first, InputIterator last) {
187
8.26k
        size_type n = last - first;
188
8.26k
        clear();
189
8.26k
        if (capacity() < n) {
190
632
            change_capacity(n);
191
632
        }
192
8.26k
        _size += n;
193
8.26k
        fill(item_ptr(0), first, last);
194
8.26k
    }
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
9.95k
    void assign(InputIterator first, InputIterator last) {
187
9.95k
        size_type n = last - first;
188
9.95k
        clear();
189
9.95k
        if (capacity() < n) {
190
61
            change_capacity(n);
191
61
        }
192
9.95k
        _size += n;
193
9.95k
        fill(item_ptr(0), first, last);
194
9.95k
    }
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
567k
    void assign(InputIterator first, InputIterator last) {
187
567k
        size_type n = last - first;
188
567k
        clear();
189
567k
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
567k
        _size += n;
193
567k
        fill(item_ptr(0), first, last);
194
567k
    }
195
196
85.3M
    prevector() = default;
prevector<36u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
84.8M
    prevector() = default;
prevector<33u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
482k
    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
13
    prevector() = default;
197
198
    explicit prevector(size_type n) {
199
        resize(n);
200
    }
201
202
2.44M
    explicit prevector(size_type n, const T& val) {
203
2.44M
        change_capacity(n);
204
2.44M
        _size += n;
205
2.44M
        fill(item_ptr(0), n, val);
206
2.44M
    }
prevector<33u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
85.7k
    explicit prevector(size_type n, const T& val) {
203
85.7k
        change_capacity(n);
204
85.7k
        _size += n;
205
85.7k
        fill(item_ptr(0), n, val);
206
85.7k
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
2.36M
    explicit prevector(size_type n, const T& val) {
203
2.36M
        change_capacity(n);
204
2.36M
        _size += n;
205
2.36M
        fill(item_ptr(0), n, val);
206
2.36M
    }
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
37.1k
    prevector(InputIterator first, InputIterator last) {
210
37.1k
        size_type n = last - first;
211
37.1k
        change_capacity(n);
212
37.1k
        _size += n;
213
37.1k
        fill(item_ptr(0), first, last);
214
37.1k
    }
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
269k
    prevector(InputIterator first, InputIterator last) {
210
269k
        size_type n = last - first;
211
269k
        change_capacity(n);
212
269k
        _size += n;
213
269k
        fill(item_ptr(0), first, last);
214
269k
    }
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
269k
    prevector(InputIterator first, InputIterator last) {
210
269k
        size_type n = last - first;
211
269k
        change_capacity(n);
212
269k
        _size += n;
213
269k
        fill(item_ptr(0), first, last);
214
269k
    }
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
6.79k
    prevector(InputIterator first, InputIterator last) {
210
6.79k
        size_type n = last - first;
211
6.79k
        change_capacity(n);
212
6.79k
        _size += n;
213
6.79k
        fill(item_ptr(0), first, last);
214
6.79k
    }
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
369k
    prevector(InputIterator first, InputIterator last) {
210
369k
        size_type n = last - first;
211
369k
        change_capacity(n);
212
369k
        _size += n;
213
369k
        fill(item_ptr(0), first, last);
214
369k
    }
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
197
    prevector(InputIterator first, InputIterator last) {
210
197
        size_type n = last - first;
211
197
        change_capacity(n);
212
197
        _size += n;
213
197
        fill(item_ptr(0), first, last);
214
197
    }
215
216
47.6M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
47.6M
        size_type n = other.size();
218
47.6M
        change_capacity(n);
219
47.6M
        _size += n;
220
47.6M
        fill(item_ptr(0), other.begin(),  other.end());
221
47.6M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
3.00M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
3.00M
        size_type n = other.size();
218
3.00M
        change_capacity(n);
219
3.00M
        _size += n;
220
3.00M
        fill(item_ptr(0), other.begin(),  other.end());
221
3.00M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
44.6M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
44.6M
        size_type n = other.size();
218
44.6M
        change_capacity(n);
219
44.6M
        _size += n;
220
44.6M
        fill(item_ptr(0), other.begin(),  other.end());
221
44.6M
    }
222
223
    prevector(prevector<N, T, Size, Diff>&& other) noexcept
224
6.71M
        : _union(std::move(other._union)), _size(other._size)
225
6.71M
    {
226
6.71M
        other._size = 0;
227
6.71M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
542k
        : _union(std::move(other._union)), _size(other._size)
225
542k
    {
226
542k
        other._size = 0;
227
542k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
6.16M
        : _union(std::move(other._union)), _size(other._size)
225
6.16M
    {
226
6.16M
        other._size = 0;
227
6.16M
    }
228
229
1.03M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
1.03M
        if (&other == this) {
231
13.1k
            return *this;
232
13.1k
        }
233
1.02M
        assign(other.begin(), other.end());
234
1.02M
        return *this;
235
1.03M
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
994k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
994k
        if (&other == this) {
231
13.1k
            return *this;
232
13.1k
        }
233
981k
        assign(other.begin(), other.end());
234
981k
        return *this;
235
994k
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
33.9k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
33.9k
        if (&other == this) {
231
2
            return *this;
232
2
        }
233
33.9k
        assign(other.begin(), other.end());
234
33.9k
        return *this;
235
33.9k
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int> const&)
Line
Count
Source
229
8.26k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
8.26k
        if (&other == this) {
231
0
            return *this;
232
0
        }
233
8.26k
        assign(other.begin(), other.end());
234
8.26k
        return *this;
235
8.26k
    }
236
237
39.4M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
39.4M
        if (!is_direct()) {
239
25.0k
            free(_union.indirect_contents.indirect);
240
25.0k
        }
241
39.4M
        _union = std::move(other._union);
242
39.4M
        _size = other._size;
243
39.4M
        other._size = 0;
244
39.4M
        return *this;
245
39.4M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
600k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
600k
        if (!is_direct()) {
239
8
            free(_union.indirect_contents.indirect);
240
8
        }
241
600k
        _union = std::move(other._union);
242
600k
        _size = other._size;
243
600k
        other._size = 0;
244
600k
        return *this;
245
600k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
38.8M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
38.8M
        if (!is_direct()) {
239
22.5k
            free(_union.indirect_contents.indirect);
240
22.5k
        }
241
38.8M
        _union = std::move(other._union);
242
38.8M
        _size = other._size;
243
38.8M
        other._size = 0;
244
38.8M
        return *this;
245
38.8M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int>&&)
Line
Count
Source
237
4.07k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
4.07k
        if (!is_direct()) {
239
2.55k
            free(_union.indirect_contents.indirect);
240
2.55k
        }
241
4.07k
        _union = std::move(other._union);
242
4.07k
        _size = other._size;
243
4.07k
        other._size = 0;
244
4.07k
        return *this;
245
4.07k
    }
246
247
1.99G
    size_type size() const {
248
1.99G
        return is_direct() ? _size : _size - N - 1;
249
1.99G
    }
prevector<36u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.97G
    size_type size() const {
248
1.97G
        return is_direct() ? _size : _size - N - 1;
249
1.97G
    }
prevector<16u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
15.9M
    size_type size() const {
248
15.9M
        return is_direct() ? _size : _size - N - 1;
249
15.9M
    }
prevector<33u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
339k
    size_type size() const {
248
339k
        return is_direct() ? _size : _size - N - 1;
249
339k
    }
prevector<8u, int, unsigned int, int>::size() const
Line
Count
Source
247
7.24M
    size_type size() const {
248
7.24M
        return is_direct() ? _size : _size - N - 1;
249
7.24M
    }
prevector<4u, Network, unsigned int, int>::size() const
Line
Count
Source
247
122
    size_type size() const {
248
122
        return is_direct() ? _size : _size - N - 1;
249
122
    }
prevector<35u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.37k
    size_type size() const {
248
1.37k
        return is_direct() ? _size : _size - N - 1;
249
1.37k
    }
250
251
30.5M
    bool empty() const {
252
30.5M
        return size() == 0;
253
30.5M
    }
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<36u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
30.1M
    bool empty() const {
252
30.1M
        return size() == 0;
253
30.1M
    }
prevector<8u, int, unsigned int, int>::empty() const
Line
Count
Source
251
269k
    bool empty() const {
252
269k
        return size() == 0;
253
269k
    }
prevector<4u, Network, unsigned int, int>::empty() const
Line
Count
Source
251
13
    bool empty() const {
252
13
        return size() == 0;
253
13
    }
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.30M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<35u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
394
    iterator begin() { return iterator(item_ptr(0)); }
256
140M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
131M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<16u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
7.54M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<8u, int, unsigned int, int>::begin() const
Line
Count
Source
256
1.89M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
257
46.7M
    iterator end() { return iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
42.3M
    iterator end() { return iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
1.30M
    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.06M
    iterator end() { return iterator(item_ptr(size())); }
prevector<35u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
394
    iterator end() { return iterator(item_ptr(size())); }
258
1.43G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.42G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
3.51M
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<8u, int, unsigned int, int>::end() const
Line
Count
Source
258
1.89M
    const_iterator end() const { return const_iterator(item_ptr(size())); }
259
260
17.8M
    size_t capacity() const {
261
17.8M
        if (is_direct()) {
262
11.9M
            return N;
263
11.9M
        } else {
264
5.87M
            return _union.indirect_contents.capacity;
265
5.87M
        }
266
17.8M
    }
prevector<36u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
16.9M
    size_t capacity() const {
261
16.9M
        if (is_direct()) {
262
11.1M
            return N;
263
11.1M
        } else {
264
5.81M
            return _union.indirect_contents.capacity;
265
5.81M
        }
266
16.9M
    }
prevector<16u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
611k
    size_t capacity() const {
261
611k
        if (is_direct()) {
262
611k
            return N;
263
611k
        } else {
264
10
            return _union.indirect_contents.capacity;
265
10
        }
266
611k
    }
prevector<8u, int, unsigned int, int>::capacity() const
Line
Count
Source
260
93.6k
    size_t capacity() const {
261
93.6k
        if (is_direct()) {
262
33.3k
            return N;
263
60.2k
        } else {
264
60.2k
            return _union.indirect_contents.capacity;
265
60.2k
        }
266
93.6k
    }
prevector<4u, Network, unsigned int, int>::capacity() const
Line
Count
Source
260
48
    size_t capacity() const {
261
48
        if (is_direct()) {
262
48
            return N;
263
48
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
48
    }
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
394
    size_t capacity() const {
261
394
        if (is_direct()) {
262
394
            return N;
263
394
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
394
    }
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.87M
    T& operator[](size_type pos) {
269
1.87M
        return *item_ptr(pos);
270
1.87M
    }
prevector<33u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
254k
    T& operator[](size_type pos) {
269
254k
        return *item_ptr(pos);
270
254k
    }
prevector<8u, int, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
8.78M
    T& operator[](size_type pos) {
269
8.78M
        return *item_ptr(pos);
270
8.78M
    }
prevector<4u, Network, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
13
    T& operator[](size_type pos) {
269
13
        return *item_ptr(pos);
270
13
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
5.00k
    T& operator[](size_type pos) {
269
5.00k
        return *item_ptr(pos);
270
5.00k
    }
271
272
19.7M
    const T& operator[](size_type pos) const {
273
19.7M
        return *item_ptr(pos);
274
19.7M
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
8.48M
    const T& operator[](size_type pos) const {
273
8.48M
        return *item_ptr(pos);
274
8.48M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
11.3M
    const T& operator[](size_type pos) const {
273
11.3M
        return *item_ptr(pos);
274
11.3M
    }
275
276
93.6M
    void resize(size_type new_size) {
277
93.6M
        size_type cur_size = size();
278
93.6M
        if (cur_size == new_size) {
279
78.7M
            return;
280
78.7M
        }
281
14.9M
        if (cur_size > new_size) {
282
14.3M
            erase(item_ptr(new_size), end());
283
14.3M
            return;
284
14.3M
        }
285
518k
        if (new_size > capacity()) {
286
80.9k
            change_capacity(new_size);
287
80.9k
        }
288
518k
        ptrdiff_t increase = new_size - cur_size;
289
518k
        fill(item_ptr(cur_size), increase);
290
518k
        _size += increase;
291
518k
    }
prevector<36u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
92.8M
    void resize(size_type new_size) {
277
92.8M
        size_type cur_size = size();
278
92.8M
        if (cur_size == new_size) {
279
78.6M
            return;
280
78.6M
        }
281
14.1M
        if (cur_size > new_size) {
282
13.7M
            erase(item_ptr(new_size), end());
283
13.7M
            return;
284
13.7M
        }
285
384k
        if (new_size > capacity()) {
286
80.3k
            change_capacity(new_size);
287
80.3k
        }
288
384k
        ptrdiff_t increase = new_size - cur_size;
289
384k
        fill(item_ptr(cur_size), increase);
290
384k
        _size += increase;
291
384k
    }
prevector<16u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
652k
    void resize(size_type new_size) {
277
652k
        size_type cur_size = size();
278
652k
        if (cur_size == new_size) {
279
101
            return;
280
101
        }
281
652k
        if (cur_size > new_size) {
282
652k
            erase(item_ptr(new_size), end());
283
652k
            return;
284
652k
        }
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.2k
    void resize(size_type new_size) {
277
29.2k
        size_type cur_size = size();
278
29.2k
        if (cur_size == new_size) {
279
10.1k
            return;
280
10.1k
        }
281
19.1k
        if (cur_size > new_size) {
282
12.6k
            erase(item_ptr(new_size), end());
283
12.6k
            return;
284
12.6k
        }
285
6.50k
        if (new_size > capacity()) {
286
315
            change_capacity(new_size);
287
315
        }
288
6.50k
        ptrdiff_t increase = new_size - cur_size;
289
6.50k
        fill(item_ptr(cur_size), increase);
290
6.50k
        _size += increase;
291
6.50k
    }
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.78k
            change_capacity(new_capacity);
296
1.78k
        }
297
4.16k
    }
298
299
90.0M
    void shrink_to_fit() {
300
90.0M
        change_capacity(size());
301
90.0M
    }
prevector<36u, unsigned char, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
90.0M
    void shrink_to_fit() {
300
90.0M
        change_capacity(size());
301
90.0M
    }
prevector<8u, int, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
1.98k
    void shrink_to_fit() {
300
1.98k
        change_capacity(size());
301
1.98k
    }
302
303
93.0M
    void clear() {
304
93.0M
        resize(0);
305
93.0M
    }
prevector<36u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
92.4M
    void clear() {
304
92.4M
        resize(0);
305
92.4M
    }
prevector<16u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
611k
    void clear() {
304
611k
        resize(0);
305
611k
    }
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.00M
    iterator insert(iterator pos, const T& value) {
308
9.00M
        size_type p = pos - begin();
309
9.00M
        size_type new_size = size() + 1;
310
9.00M
        if (capacity() < new_size) {
311
8.10k
            change_capacity(new_size + (new_size >> 1));
312
8.10k
        }
313
9.00M
        T* ptr = item_ptr(p);
314
9.00M
        T* dst = ptr + 1;
315
9.00M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.00M
        _size++;
317
9.00M
        new(static_cast<void*>(ptr)) T(value);
318
9.00M
        return iterator(ptr);
319
9.00M
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const&)
Line
Count
Source
307
8.96M
    iterator insert(iterator pos, const T& value) {
308
8.96M
        size_type p = pos - begin();
309
8.96M
        size_type new_size = size() + 1;
310
8.96M
        if (capacity() < new_size) {
311
6.65k
            change_capacity(new_size + (new_size >> 1));
312
6.65k
        }
313
8.96M
        T* ptr = item_ptr(p);
314
8.96M
        T* dst = ptr + 1;
315
8.96M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
8.96M
        _size++;
317
8.96M
        new(static_cast<void*>(ptr)) T(value);
318
8.96M
        return iterator(ptr);
319
8.96M
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, int const&)
Line
Count
Source
307
32.8k
    iterator insert(iterator pos, const T& value) {
308
32.8k
        size_type p = pos - begin();
309
32.8k
        size_type new_size = size() + 1;
310
32.8k
        if (capacity() < new_size) {
311
1.45k
            change_capacity(new_size + (new_size >> 1));
312
1.45k
        }
313
32.8k
        T* ptr = item_ptr(p);
314
32.8k
        T* dst = ptr + 1;
315
32.8k
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
32.8k
        _size++;
317
32.8k
        new(static_cast<void*>(ptr)) T(value);
318
32.8k
        return iterator(ptr);
319
32.8k
    }
320
321
16.5k
    void insert(iterator pos, size_type count, const T& value) {
322
16.5k
        size_type p = pos - begin();
323
16.5k
        size_type new_size = size() + count;
324
16.5k
        if (capacity() < new_size) {
325
814
            change_capacity(new_size + (new_size >> 1));
326
814
        }
327
16.5k
        T* ptr = item_ptr(p);
328
16.5k
        T* dst = ptr + count;
329
16.5k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.5k
        _size += count;
331
16.5k
        fill(item_ptr(p), count, value);
332
16.5k
    }
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
807
            change_capacity(new_size + (new_size >> 1));
326
807
        }
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.46M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
5.46M
        size_type p = pos - begin();
337
5.46M
        difference_type count = last - first;
338
5.46M
        size_type new_size = size() + count;
339
5.46M
        if (capacity() < new_size) {
340
368k
            change_capacity(new_size + (new_size >> 1));
341
368k
        }
342
5.46M
        T* ptr = item_ptr(p);
343
5.46M
        T* dst = ptr + count;
344
5.46M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
5.46M
        _size += count;
346
5.46M
        fill(ptr, first, last);
347
5.46M
    }
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.68M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.68M
        size_type p = pos - begin();
337
2.68M
        difference_type count = last - first;
338
2.68M
        size_type new_size = size() + count;
339
2.68M
        if (capacity() < new_size) {
340
223k
            change_capacity(new_size + (new_size >> 1));
341
223k
        }
342
2.68M
        T* ptr = item_ptr(p);
343
2.68M
        T* dst = ptr + count;
344
2.68M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.68M
        _size += count;
346
2.68M
        fill(ptr, first, last);
347
2.68M
    }
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.18k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
4.18k
        size_type p = pos - begin();
337
4.18k
        difference_type count = last - first;
338
4.18k
        size_type new_size = size() + count;
339
4.18k
        if (capacity() < new_size) {
340
322
            change_capacity(new_size + (new_size >> 1));
341
322
        }
342
4.18k
        T* ptr = item_ptr(p);
343
4.18k
        T* dst = ptr + count;
344
4.18k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
4.18k
        _size += count;
346
4.18k
        fill(ptr, first, last);
347
4.18k
    }
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.75M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.75M
        size_type p = pos - begin();
337
2.75M
        difference_type count = last - first;
338
2.75M
        size_type new_size = size() + count;
339
2.75M
        if (capacity() < new_size) {
340
127k
            change_capacity(new_size + (new_size >> 1));
341
127k
        }
342
2.75M
        T* ptr = item_ptr(p);
343
2.75M
        T* dst = ptr + count;
344
2.75M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.75M
        _size += count;
346
2.75M
        fill(ptr, first, last);
347
2.75M
    }
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
197
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
197
        size_type p = pos - begin();
337
197
        difference_type count = last - first;
338
197
        size_type new_size = size() + count;
339
197
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
197
        T* ptr = item_ptr(p);
343
197
        T* dst = ptr + count;
344
197
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
197
        _size += count;
346
197
        fill(ptr, first, last);
347
197
    }
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
197
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
197
        size_type p = pos - begin();
337
197
        difference_type count = last - first;
338
197
        size_type new_size = size() + count;
339
197
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
197
        T* ptr = item_ptr(p);
343
197
        T* dst = ptr + count;
344
197
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
197
        _size += count;
346
197
        fill(ptr, first, last);
347
197
    }
348
349
988k
    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
988k
        if (capacity() < new_size) {
353
218k
            change_capacity(new_size);
354
218k
            _size += new_size - size();
355
218k
            return;
356
218k
        }
357
769k
        if (new_size < size()) {
358
3.31k
            erase(item_ptr(new_size), end());
359
766k
        } else {
360
766k
            _size += new_size - size();
361
766k
        }
362
769k
    }
prevector<36u, unsigned char, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
980k
    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
980k
        if (capacity() < new_size) {
353
217k
            change_capacity(new_size);
354
217k
            _size += new_size - size();
355
217k
            return;
356
217k
        }
357
762k
        if (new_size < size()) {
358
0
            erase(item_ptr(new_size), end());
359
762k
        } else {
360
762k
            _size += new_size - size();
361
762k
        }
362
762k
    }
prevector<8u, int, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
8.39k
    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.39k
        if (capacity() < new_size) {
353
1.18k
            change_capacity(new_size);
354
1.18k
            _size += new_size - size();
355
1.18k
            return;
356
1.18k
        }
357
7.21k
        if (new_size < size()) {
358
3.31k
            erase(item_ptr(new_size), end());
359
3.90k
        } else {
360
3.90k
            _size += new_size - size();
361
3.90k
        }
362
7.21k
    }
363
364
27.9k
    iterator erase(iterator pos) {
365
27.9k
        return erase(pos, pos + 1);
366
27.9k
    }
367
368
14.4M
    iterator erase(iterator first, iterator last) {
369
        // Erase is not allowed to the change the object's capacity. That means
370
        // that when starting with an indirectly allocated prevector with
371
        // size and capacity > N, the result may be a still indirectly allocated
372
        // prevector with size <= N and capacity > N. A shrink_to_fit() call is
373
        // necessary to switch to the (more efficient) directly allocated
374
        // representation (with capacity N and size <= N).
375
14.4M
        iterator p = first;
376
14.4M
        char* endp = (char*)&(*end());
377
14.4M
        _size -= last - p;
378
14.4M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
14.4M
        return first;
380
14.4M
    }
prevector<36u, unsigned char, unsigned int, int>::erase(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
368
13.7M
    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
13.7M
        iterator p = first;
376
13.7M
        char* endp = (char*)&(*end());
377
13.7M
        _size -= last - p;
378
13.7M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
13.7M
        return first;
380
13.7M
    }
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
652k
    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
652k
        iterator p = first;
376
652k
        char* endp = (char*)&(*end());
377
652k
        _size -= last - p;
378
652k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
652k
        return first;
380
652k
    }
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
71.2k
    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
71.2k
        iterator p = first;
376
71.2k
        char* endp = (char*)&(*end());
377
71.2k
        _size -= last - p;
378
71.2k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
71.2k
        return first;
380
71.2k
    }
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
80.3k
    void emplace_back(Args&&... args) {
384
80.3k
        size_type new_size = size() + 1;
385
80.3k
        if (capacity() < new_size) {
386
13.2k
            change_capacity(new_size + (new_size >> 1));
387
13.2k
        }
388
80.3k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
80.3k
        _size++;
390
80.3k
    }
void prevector<36u, unsigned char, unsigned int, int>::emplace_back<unsigned char const&>(unsigned char const&)
Line
Count
Source
383
72.0k
    void emplace_back(Args&&... args) {
384
72.0k
        size_type new_size = size() + 1;
385
72.0k
        if (capacity() < new_size) {
386
13.0k
            change_capacity(new_size + (new_size >> 1));
387
13.0k
        }
388
72.0k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
72.0k
        _size++;
390
72.0k
    }
void prevector<8u, int, unsigned int, int>::emplace_back<int const&>(int const&)
Line
Count
Source
383
8.31k
    void emplace_back(Args&&... args) {
384
8.31k
        size_type new_size = size() + 1;
385
8.31k
        if (capacity() < new_size) {
386
226
            change_capacity(new_size + (new_size >> 1));
387
226
        }
388
8.31k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
8.31k
        _size++;
390
8.31k
    }
void prevector<4u, Network, unsigned int, int>::emplace_back<Network const&>(Network const&)
Line
Count
Source
383
48
    void emplace_back(Args&&... args) {
384
48
        size_type new_size = size() + 1;
385
48
        if (capacity() < new_size) {
386
0
            change_capacity(new_size + (new_size >> 1));
387
0
        }
388
48
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
48
        _size++;
390
48
    }
391
392
80.3k
    void push_back(const T& value) {
393
80.3k
        emplace_back(value);
394
80.3k
    }
prevector<36u, unsigned char, unsigned int, int>::push_back(unsigned char const&)
Line
Count
Source
392
72.0k
    void push_back(const T& value) {
393
72.0k
        emplace_back(value);
394
72.0k
    }
prevector<8u, int, unsigned int, int>::push_back(int const&)
Line
Count
Source
392
8.31k
    void push_back(const T& value) {
393
8.31k
        emplace_back(value);
394
8.31k
    }
prevector<4u, Network, unsigned int, int>::push_back(Network const&)
Line
Count
Source
392
48
    void push_back(const T& value) {
393
48
        emplace_back(value);
394
48
    }
395
396
6.89k
    void pop_back() {
397
6.89k
        erase(end() - 1, end());
398
6.89k
    }
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.7k
    const T& back() const {
413
27.7k
        return *item_ptr(size() - 1);
414
27.7k
    }
415
416
    void swap(prevector<N, T, Size, Diff>& other) noexcept
417
16.5k
    {
418
16.5k
        std::swap(_union, other._union);
419
16.5k
        std::swap(_size, other._size);
420
16.5k
    }
421
422
143M
    ~prevector() {
423
143M
        if (!is_direct()) {
424
2.25M
            free(_union.indirect_contents.indirect);
425
2.25M
            _union.indirect_contents.indirect = nullptr;
426
2.25M
        }
427
143M
    }
prevector<16u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
5.89M
    ~prevector() {
423
5.89M
        if (!is_direct()) {
424
1.94k
            free(_union.indirect_contents.indirect);
425
1.94k
            _union.indirect_contents.indirect = nullptr;
426
1.94k
        }
427
5.89M
    }
prevector<36u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
136M
    ~prevector() {
423
136M
        if (!is_direct()) {
424
2.04M
            free(_union.indirect_contents.indirect);
425
2.04M
            _union.indirect_contents.indirect = nullptr;
426
2.04M
        }
427
136M
    }
prevector<33u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
567k
    ~prevector() {
423
567k
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
567k
    }
prevector<8u, int, unsigned int, int>::~prevector()
Line
Count
Source
422
538k
    ~prevector() {
423
538k
        if (!is_direct()) {
424
207k
            free(_union.indirect_contents.indirect);
425
207k
            _union.indirect_contents.indirect = nullptr;
426
207k
        }
427
538k
    }
prevector<4u, Network, unsigned int, int>::~prevector()
Line
Count
Source
422
13
    ~prevector() {
423
13
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
13
    }
prevector<35u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
197
    ~prevector() {
423
197
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
197
    }
428
429
6.53M
    constexpr bool operator==(const prevector& other) const {
430
6.53M
        return std::ranges::equal(*this, other);
431
6.53M
    }
prevector<36u, unsigned char, unsigned int, int>::operator==(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
5.77M
    constexpr bool operator==(const prevector& other) const {
430
5.77M
        return std::ranges::equal(*this, other);
431
5.77M
    }
prevector<8u, int, unsigned int, int>::operator==(prevector<8u, int, unsigned int, int> const&) const
Line
Count
Source
429
538k
    constexpr bool operator==(const prevector& other) const {
430
538k
        return std::ranges::equal(*this, other);
431
538k
    }
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.3M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.3M
        if (size() < other.size()) {
435
789k
            return true;
436
789k
        }
437
20.5M
        if (size() > other.size()) {
438
281k
            return false;
439
281k
        }
440
20.3M
        const_iterator b1 = begin();
441
20.3M
        const_iterator b2 = other.begin();
442
20.3M
        const_iterator e1 = end();
443
132M
        while (b1 != e1) {
444
129M
            if ((*b1) < (*b2)) {
445
9.91M
                return true;
446
9.91M
            }
447
119M
            if ((*b2) < (*b1)) {
448
7.66M
                return false;
449
7.66M
            }
450
111M
            ++b1;
451
111M
            ++b2;
452
111M
        }
453
2.73M
        return false;
454
20.3M
    }
prevector<36u, unsigned char, unsigned int, int>::operator<(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
21.3M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.3M
        if (size() < other.size()) {
435
789k
            return true;
436
789k
        }
437
20.5M
        if (size() > other.size()) {
438
281k
            return false;
439
281k
        }
440
20.2M
        const_iterator b1 = begin();
441
20.2M
        const_iterator b2 = other.begin();
442
20.2M
        const_iterator e1 = end();
443
132M
        while (b1 != e1) {
444
129M
            if ((*b1) < (*b2)) {
445
9.91M
                return true;
446
9.91M
            }
447
119M
            if ((*b2) < (*b1)) {
448
7.66M
                return false;
449
7.66M
            }
450
111M
            ++b1;
451
111M
            ++b2;
452
111M
        }
453
2.70M
        return false;
454
20.2M
    }
prevector<16u, unsigned char, unsigned int, int>::operator<(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
28.2k
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
28.2k
        if (size() < other.size()) {
435
0
            return true;
436
0
        }
437
28.2k
        if (size() > other.size()) {
438
0
            return false;
439
0
        }
440
28.2k
        const_iterator b1 = begin();
441
28.2k
        const_iterator b2 = other.begin();
442
28.2k
        const_iterator e1 = end();
443
141k
        while (b1 != e1) {
444
113k
            if ((*b1) < (*b2)) {
445
255
                return true;
446
255
            }
447
113k
            if ((*b2) < (*b1)) {
448
88
                return false;
449
88
            }
450
113k
            ++b1;
451
113k
            ++b2;
452
113k
        }
453
27.8k
        return false;
454
28.2k
    }
455
456
51.9M
    size_t allocated_memory() const {
457
51.9M
        if (is_direct()) {
458
51.0M
            return 0;
459
51.0M
        } else {
460
837k
            return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity;
461
837k
        }
462
51.9M
    }
463
464
553k
    value_type* data() {
465
553k
        return item_ptr(0);
466
553k
    }
prevector<16u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
41.9k
    value_type* data() {
465
41.9k
        return item_ptr(0);
466
41.9k
    }
prevector<33u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
212k
    value_type* data() {
465
212k
        return item_ptr(0);
466
212k
    }
prevector<36u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
298k
    value_type* data() {
465
298k
        return item_ptr(0);
466
298k
    }
prevector<35u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
197
    value_type* data() {
465
197
        return item_ptr(0);
466
197
    }
467
468
30.9M
    const value_type* data() const {
469
30.9M
        return item_ptr(0);
470
30.9M
    }
prevector<16u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
2.69M
    const value_type* data() const {
469
2.69M
        return item_ptr(0);
470
2.69M
    }
prevector<36u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
28.1M
    const value_type* data() const {
469
28.1M
        return item_ptr(0);
470
28.1M
    }
prevector<33u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
85.7k
    const value_type* data() const {
469
85.7k
        return item_ptr(0);
470
85.7k
    }
471
};
472
473
#endif // BITCOIN_PREVECTOR_H