Coverage Report

Created: 2026-09-14 20:36

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/tmp/bitcoin/src/prevector.h
Line
Count
Source
1
// Copyright (c) 2015-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_PREVECTOR_H
6
#define BITCOIN_PREVECTOR_H
7
8
#include <algorithm>
9
#include <cassert>
10
#include <cstdint>
11
#include <cstdlib>
12
#include <cstring>
13
#include <iterator>
14
#include <new>
15
#include <type_traits>
16
#include <utility>
17
18
/** Implements a drop-in replacement for std::vector<T> which stores up to N
19
 *  elements directly (without heap allocation). The types Size and Diff are
20
 *  used to store element counts, and can be any unsigned + signed type.
21
 *
22
 *  Storage layout is either:
23
 *  - Direct allocation:
24
 *    - Size _size: the number of used elements (between 0 and N)
25
 *    - T direct[N]: an array of N elements of type T
26
 *      (only the first _size are initialized).
27
 *  - Indirect allocation:
28
 *    - Size _size: the number of used elements plus N + 1
29
 *    - Size capacity: the number of allocated elements
30
 *    - T* indirect: a pointer to an array of capacity elements of type T
31
 *      (only the first _size are initialized).
32
 *
33
 *  The data type T must be movable by memmove/realloc(). Once we switch to C++,
34
 *  move constructors can be used instead.
35
 */
36
template<unsigned int N, typename T, typename Size = uint32_t, typename Diff = int32_t>
37
class prevector {
38
    static_assert(std::is_trivially_copyable_v<T>);
39
40
public:
41
    static constexpr unsigned int STATIC_SIZE{N};
42
43
    typedef Size size_type;
44
    typedef Diff difference_type;
45
    typedef T value_type;
46
    typedef value_type& reference;
47
    typedef const value_type& const_reference;
48
    typedef value_type* pointer;
49
    typedef const value_type* const_pointer;
50
51
    class iterator {
52
        T* ptr{};
53
    public:
54
        typedef Diff difference_type;
55
        typedef T* pointer;
56
        typedef T& reference;
57
        using element_type = T;
58
        using iterator_category = std::contiguous_iterator_tag;
59
        iterator() = default;
60
90.3M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
74.9M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
437k
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::iterator::iterator(int*)
Line
Count
Source
60
14.9M
        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
716
        iterator(T* ptr_) : ptr(ptr_) {}
61
149M
        T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
136M
        T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
875k
        T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
11.7M
        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
716
        T& operator*() const { return *ptr; }
62
35.4k
        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.4k
        T* operator->() const { return ptr; }
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::iterator::operator->() const
63
2.14M
        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.28M
        iterator& operator++() { ptr++; return *this; }
65
4.28M
        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
27.0M
        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
26.5M
        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
145k
        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
390k
        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
358
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
69
4.43M
        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.15M
        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.23M
        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.69G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::const_iterator::const_iterator(unsigned char const*)
Line
Count
Source
87
7.35M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::const_iterator::const_iterator(unsigned char const*)
Line
Count
Source
87
1.68G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::const_iterator::const_iterator(int const*)
Line
Count
Source
87
3.75M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
88
748k
        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
11.7M
        const T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
17.2M
        const T& operator*() const { return *ptr; }
90
3.95M
        const T* operator->() const { return ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
3.95M
        const T* operator->() const { return ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
502
        const T* operator->() const { return ptr; }
91
184k
        const T& operator[](size_type pos) const { return ptr[pos]; }
92
16.2G
        const_iterator& operator++() { ptr++; return *this; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
16.2G
        const_iterator& operator++() { ptr++; return *this; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
6.31M
        const_iterator& operator++() { ptr++; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
12.9M
        const_iterator& operator++() { ptr++; return *this; }
93
4.28M
        const_iterator& operator--() { ptr--; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator--()
Line
Count
Source
93
4.28M
        const_iterator& operator--() { ptr--; return *this; }
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator--()
94
736M
        const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
95
        const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
96
788M
        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
786M
        difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
96
474k
        difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<8u, int, unsigned int, int>::const_iterator, prevector<8u, int, unsigned int, int>::const_iterator)
Line
Count
Source
96
1.07M
        difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
97
6.03M
        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.37M
        const_iterator& operator+=(size_type n) { ptr += n; return *this; }
100
590
        const_iterator operator-(size_type n) const { return const_iterator(ptr - n); }
101
        const_iterator& operator-=(size_type n) { ptr -= n; return *this; }
102
15.4G
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator==(prevector<36u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
102
15.4G
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator==(prevector<16u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
102
7.12M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator==(prevector<8u, int, unsigned int, int>::const_iterator) const
Line
Count
Source
102
12.1M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
103
1.46G
        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.46G
        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
120M
    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
115M
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
prevector<16u, unsigned char, unsigned int, int>::direct_ptr(int)
Line
Count
Source
122
2.07M
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
prevector<33u, unsigned char, unsigned int, int>::direct_ptr(int)
Line
Count
Source
122
745k
    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
932
    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.43k
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
123
293M
    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
274M
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
prevector<16u, unsigned char, unsigned int, int>::direct_ptr(int) const
Line
Count
Source
123
16.7M
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
prevector<8u, int, unsigned int, int>::direct_ptr(int) const
Line
Count
Source
123
1.56M
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
prevector<33u, unsigned char, unsigned int, int>::direct_ptr(int) const
Line
Count
Source
123
118k
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
124
35.5M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
20.4M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
2.45k
    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.0M
    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.44G
    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.44G
    const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int) const
Line
Count
Source
125
6.02k
    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.19M
    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.37G
    bool is_direct() const { return _size <= N; }
prevector<36u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.31G
    bool is_direct() const { return _size <= N; }
prevector<16u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
31.4M
    bool is_direct() const { return _size <= N; }
prevector<33u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
2.10M
    bool is_direct() const { return _size <= N; }
prevector<8u, int, unsigned int, int>::is_direct() const
Line
Count
Source
126
29.7M
    bool is_direct() const { return _size <= N; }
prevector<4u, Network, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.72k
    bool is_direct() const { return _size <= N; }
prevector<35u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.40k
    bool is_direct() const { return _size <= N; }
127
128
131M
    void change_capacity(size_type new_capacity) {
129
131M
        if (new_capacity <= N) {
130
129M
            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
129M
        } else {
139
2.44M
            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.1k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
83.1k
                assert(_union.indirect_contents.indirect);
145
83.1k
                _union.indirect_contents.capacity = new_capacity;
146
2.35M
            } else {
147
2.35M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.35M
                assert(new_indirect);
149
2.35M
                T* src = direct_ptr(0);
150
2.35M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.35M
                memcpy(dst, src, size() * sizeof(T));
152
2.35M
                _union.indirect_contents.indirect = new_indirect;
153
2.35M
                _union.indirect_contents.capacity = new_capacity;
154
2.35M
                _size += N + 1;
155
2.35M
            }
156
2.44M
        }
157
131M
    }
prevector<36u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
129M
    void change_capacity(size_type new_capacity) {
129
129M
        if (new_capacity <= N) {
130
127M
            if (!is_direct()) {
131
44.6k
                T* indirect = indirect_ptr(0);
132
44.6k
                T* src = indirect;
133
44.6k
                T* dst = direct_ptr(0);
134
44.6k
                memcpy(dst, src, size() * sizeof(T));
135
44.6k
                free(indirect);
136
44.6k
                _size -= N + 1;
137
44.6k
            }
138
127M
        } else {
139
2.22M
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
78.8k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
78.8k
                assert(_union.indirect_contents.indirect);
145
78.8k
                _union.indirect_contents.capacity = new_capacity;
146
2.14M
            } else {
147
2.14M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.14M
                assert(new_indirect);
149
2.14M
                T* src = direct_ptr(0);
150
2.14M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.14M
                memcpy(dst, src, size() * sizeof(T));
152
2.14M
                _union.indirect_contents.indirect = new_indirect;
153
2.14M
                _union.indirect_contents.capacity = new_capacity;
154
2.14M
                _size += N + 1;
155
2.14M
            }
156
2.22M
        }
157
129M
    }
prevector<16u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
1.48M
    void change_capacity(size_type new_capacity) {
129
1.48M
        if (new_capacity <= N) {
130
1.48M
            if (!is_direct()) {
131
0
                T* indirect = indirect_ptr(0);
132
0
                T* src = indirect;
133
0
                T* dst = direct_ptr(0);
134
0
                memcpy(dst, src, size() * sizeof(T));
135
0
                free(indirect);
136
0
                _size -= N + 1;
137
0
            }
138
1.48M
        } else {
139
2.12k
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
0
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
0
                assert(_union.indirect_contents.indirect);
145
0
                _union.indirect_contents.capacity = new_capacity;
146
2.12k
            } else {
147
2.12k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.12k
                assert(new_indirect);
149
2.12k
                T* src = direct_ptr(0);
150
2.12k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.12k
                memcpy(dst, src, size() * sizeof(T));
152
2.12k
                _union.indirect_contents.indirect = new_indirect;
153
2.12k
                _union.indirect_contents.capacity = new_capacity;
154
2.12k
                _size += N + 1;
155
2.12k
            }
156
2.12k
        }
157
1.48M
    }
prevector<33u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
118k
    void change_capacity(size_type new_capacity) {
129
118k
        if (new_capacity <= N) {
130
118k
            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
118k
        } 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
118k
    }
prevector<8u, int, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
542k
    void change_capacity(size_type new_capacity) {
129
542k
        if (new_capacity <= N) {
130
330k
            if (!is_direct()) {
131
551
                T* indirect = indirect_ptr(0);
132
551
                T* src = indirect;
133
551
                T* dst = direct_ptr(0);
134
551
                memcpy(dst, src, size() * sizeof(T));
135
551
                free(indirect);
136
551
                _size -= N + 1;
137
551
            }
138
330k
        } else {
139
212k
            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
207k
            } else {
147
207k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
207k
                assert(new_indirect);
149
207k
                T* src = direct_ptr(0);
150
207k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
207k
                memcpy(dst, src, size() * sizeof(T));
152
207k
                _union.indirect_contents.indirect = new_indirect;
153
207k
                _union.indirect_contents.capacity = new_capacity;
154
207k
                _size += N + 1;
155
207k
            }
156
212k
        }
157
542k
    }
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
179
    void change_capacity(size_type new_capacity) {
129
179
        if (new_capacity <= N) {
130
179
            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
179
        } 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
179
    }
158
159
153M
    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
133M
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<16u, unsigned char, unsigned int, int>::item_ptr(int)
Line
Count
Source
159
2.07M
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<33u, unsigned char, unsigned int, int>::item_ptr(int)
Line
Count
Source
159
745k
    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.6M
    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
932
    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.43k
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
160
1.73G
    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.71G
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<16u, unsigned char, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
16.7M
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<8u, int, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
3.75M
    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
118k
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
161
162
1.19M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
1.19M
        std::fill_n(dst, count, value);
164
1.19M
    }
prevector<36u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
594k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
594k
        std::fill_n(dst, count, value);
164
594k
    }
prevector<16u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
335k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
335k
        std::fill_n(dst, count, value);
164
335k
    }
prevector<33u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
245k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
245k
        std::fill_n(dst, count, value);
164
245k
    }
prevector<8u, int, unsigned int, int>::fill(int*, long, int const&)
Line
Count
Source
162
23.0k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
23.0k
        std::fill_n(dst, count, value);
164
23.0k
    }
165
166
    template <std::input_iterator InputIterator>
167
57.2M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.4G
        while (first != last) {
169
15.3G
            new(static_cast<void*>(dst)) T(*first);
170
15.3G
            ++dst;
171
15.3G
            ++first;
172
15.3G
        }
173
57.2M
    }
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.80M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
89.7M
        while (first != last) {
169
86.9M
            new(static_cast<void*>(dst)) T(*first);
170
86.9M
            ++dst;
171
86.9M
            ++first;
172
86.9M
        }
173
2.80M
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<prevector<16u, unsigned char, unsigned int, int>::const_iterator>(unsigned char*, prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
167
1.18M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
6.22M
        while (first != last) {
169
5.04M
            new(static_cast<void*>(dst)) T(*first);
170
5.04M
            ++dst;
171
5.04M
            ++first;
172
5.04M
        }
173
1.18M
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(unsigned char*, prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
167
52.3M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.2G
        while (first != last) {
169
15.2G
            new(static_cast<void*>(dst)) T(*first);
170
15.2G
            ++dst;
171
15.2G
            ++first;
172
15.2G
        }
173
52.3M
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
41.1k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.73M
        while (first != last) {
169
1.69M
            new(static_cast<void*>(dst)) T(*first);
170
1.69M
            ++dst;
171
1.69M
            ++first;
172
1.69M
        }
173
41.1k
    }
void prevector<33u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
1
    void fill(T* dst, InputIterator first, InputIterator last) {
168
33
        while (first != last) {
169
32
            new(static_cast<void*>(dst)) T(*first);
170
32
            ++dst;
171
32
            ++first;
172
32
        }
173
1
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<prevector<36u, unsigned char, unsigned int, int>::iterator>(unsigned char*, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
167
23.0k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
37.3M
        while (first != last) {
169
37.3M
            new(static_cast<void*>(dst)) T(*first);
170
37.3M
            ++dst;
171
37.3M
            ++first;
172
37.3M
        }
173
23.0k
    }
void prevector<8u, int, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>>(int*, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>)
Line
Count
Source
167
266k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.41M
        while (first != last) {
169
2.14M
            new(static_cast<void*>(dst)) T(*first);
170
2.14M
            ++dst;
171
2.14M
            ++first;
172
2.14M
        }
173
266k
    }
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
266k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.41M
        while (first != last) {
169
2.14M
            new(static_cast<void*>(dst)) T(*first);
170
2.14M
            ++dst;
171
2.14M
            ++first;
172
2.14M
        }
173
266k
    }
void prevector<8u, int, unsigned int, int>::fill<int*>(int*, int*, int*)
Line
Count
Source
167
4.10k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
14.3k
        while (first != last) {
169
10.2k
            new(static_cast<void*>(dst)) T(*first);
170
10.2k
            ++dst;
171
10.2k
            ++first;
172
10.2k
        }
173
4.10k
    }
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.09k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
56.6k
        while (first != last) {
169
48.5k
            new(static_cast<void*>(dst)) T(*first);
170
48.5k
            ++dst;
171
48.5k
            ++first;
172
48.5k
        }
173
8.09k
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
221k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
28.8M
        while (first != last) {
169
28.6M
            new(static_cast<void*>(dst)) T(*first);
170
28.6M
            ++dst;
171
28.6M
            ++first;
172
28.6M
        }
173
221k
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>)
Line
Count
Source
167
7
    void fill(T* dst, InputIterator first, InputIterator last) {
168
35
        while (first != last) {
169
28
            new(static_cast<void*>(dst)) T(*first);
170
28
            ++dst;
171
28
            ++first;
172
28
        }
173
7
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>)
Line
Count
Source
167
4
    void fill(T* dst, InputIterator first, InputIterator last) {
168
36
        while (first != last) {
169
32
            new(static_cast<void*>(dst)) T(*first);
170
32
            ++dst;
171
32
            ++first;
172
32
        }
173
4
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>)
Line
Count
Source
167
6
    void fill(T* dst, InputIterator first, InputIterator last) {
168
12
        while (first != last) {
169
6
            new(static_cast<void*>(dst)) T(*first);
170
6
            ++dst;
171
6
            ++first;
172
6
        }
173
6
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
12
        while (first != last) {
169
10
            new(static_cast<void*>(dst)) T(*first);
170
10
            ++dst;
171
10
            ++first;
172
10
        }
173
2
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>)
Line
Count
Source
167
7
    void fill(T* dst, InputIterator first, InputIterator last) {
168
28
        while (first != last) {
169
21
            new(static_cast<void*>(dst)) T(*first);
170
21
            ++dst;
171
21
            ++first;
172
21
        }
173
7
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
16
        while (first != last) {
169
14
            new(static_cast<void*>(dst)) T(*first);
170
14
            ++dst;
171
14
            ++first;
172
14
        }
173
2
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
52
        while (first != last) {
169
50
            new(static_cast<void*>(dst)) T(*first);
170
50
            ++dst;
171
50
            ++first;
172
50
        }
173
2
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
167
10.2k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
94.0k
        while (first != last) {
169
83.7k
            new(static_cast<void*>(dst)) T(*first);
170
83.7k
            ++dst;
171
83.7k
            ++first;
172
83.7k
        }
173
10.2k
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
10
    void fill(T* dst, InputIterator first, InputIterator last) {
168
110
        while (first != last) {
169
100
            new(static_cast<void*>(dst)) T(*first);
170
100
            ++dst;
171
100
            ++first;
172
100
        }
173
10
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
41
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.35k
        while (first != last) {
169
1.31k
            new(static_cast<void*>(dst)) T(*first);
170
1.31k
            ++dst;
171
1.31k
            ++first;
172
1.31k
        }
173
41
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
59.6k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
298k
        while (first != last) {
169
238k
            new(static_cast<void*>(dst)) T(*first);
170
238k
            ++dst;
171
238k
            ++first;
172
238k
        }
173
59.6k
    }
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
179
    void fill(T* dst, InputIterator first, InputIterator last) {
168
5.90k
        while (first != last) {
169
5.72k
            new(static_cast<void*>(dst)) T(*first);
170
5.72k
            ++dst;
171
5.72k
            ++first;
172
5.72k
        }
173
179
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
179
    void fill(T* dst, InputIterator first, InputIterator last) {
168
537
        while (first != last) {
169
358
            new(static_cast<void*>(dst)) T(*first);
170
358
            ++dst;
171
358
            ++first;
172
358
        }
173
179
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
179
    void fill(T* dst, InputIterator first, InputIterator last) {
168
358
        while (first != last) {
169
179
            new(static_cast<void*>(dst)) T(*first);
170
179
            ++dst;
171
179
            ++first;
172
179
        }
173
179
    }
174
175
public:
176
144k
    void assign(size_type n, const T& val) {
177
144k
        clear();
178
144k
        if (capacity() < n) {
179
94.6k
            change_capacity(n);
180
94.6k
        }
181
144k
        _size += n;
182
144k
        fill(item_ptr(0), n, val);
183
144k
    }
prevector<36u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&)
Line
Count
Source
176
144k
    void assign(size_type n, const T& val) {
177
144k
        clear();
178
144k
        if (capacity() < n) {
179
94.5k
            change_capacity(n);
180
94.5k
        }
181
144k
        _size += n;
182
144k
        fill(item_ptr(0), n, val);
183
144k
    }
prevector<16u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&)
Line
Count
Source
176
6
    void assign(size_type n, const T& val) {
177
6
        clear();
178
6
        if (capacity() < n) {
179
0
            change_capacity(n);
180
0
        }
181
6
        _size += n;
182
6
        fill(item_ptr(0), n, val);
183
6
    }
prevector<8u, int, unsigned int, int>::assign(unsigned int, int const&)
Line
Count
Source
176
287
    void assign(size_type n, const T& val) {
177
287
        clear();
178
287
        if (capacity() < n) {
179
131
            change_capacity(n);
180
131
        }
181
287
        _size += n;
182
287
        fill(item_ptr(0), n, val);
183
287
    }
184
185
    template <std::input_iterator InputIterator>
186
2.16M
    void assign(InputIterator first, InputIterator last) {
187
2.16M
        size_type n = last - first;
188
2.16M
        clear();
189
2.16M
        if (capacity() < n) {
190
123k
            change_capacity(n);
191
123k
        }
192
2.16M
        _size += n;
193
2.16M
        fill(item_ptr(0), first, last);
194
2.16M
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<prevector<16u, unsigned char, unsigned int, int>::const_iterator>(prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
186
34.1k
    void assign(InputIterator first, InputIterator last) {
187
34.1k
        size_type n = last - first;
188
34.1k
        clear();
189
34.1k
        if (capacity() < n) {
190
61
            change_capacity(n);
191
61
        }
192
34.1k
        _size += n;
193
34.1k
        fill(item_ptr(0), first, last);
194
34.1k
    }
void prevector<36u, unsigned char, unsigned int, int>::assign<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
186
2.05M
    void assign(InputIterator first, InputIterator last) {
187
2.05M
        size_type n = last - first;
188
2.05M
        clear();
189
2.05M
        if (capacity() < n) {
190
122k
            change_capacity(n);
191
122k
        }
192
2.05M
        _size += n;
193
2.05M
        fill(item_ptr(0), first, last);
194
2.05M
    }
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.09k
    void assign(InputIterator first, InputIterator last) {
187
8.09k
        size_type n = last - first;
188
8.09k
        clear();
189
8.09k
        if (capacity() < n) {
190
635
            change_capacity(n);
191
635
        }
192
8.09k
        _size += n;
193
8.09k
        fill(item_ptr(0), first, last);
194
8.09k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
186
10.2k
    void assign(InputIterator first, InputIterator last) {
187
10.2k
        size_type n = last - first;
188
10.2k
        clear();
189
10.2k
        if (capacity() < n) {
190
65
            change_capacity(n);
191
65
        }
192
10.2k
        _size += n;
193
10.2k
        fill(item_ptr(0), first, last);
194
10.2k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char*>(unsigned char*, unsigned char*)
Line
Count
Source
186
10
    void assign(InputIterator first, InputIterator last) {
187
10
        size_type n = last - first;
188
10
        clear();
189
10
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
10
        _size += n;
193
10
        fill(item_ptr(0), first, last);
194
10
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
186
41
    void assign(InputIterator first, InputIterator last) {
187
41
        size_type n = last - first;
188
41
        clear();
189
41
        if (capacity() < n) {
190
40
            change_capacity(n);
191
40
        }
192
41
        _size += n;
193
41
        fill(item_ptr(0), first, last);
194
41
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char const*>(unsigned char const*, unsigned char const*)
Line
Count
Source
186
59.6k
    void assign(InputIterator first, InputIterator last) {
187
59.6k
        size_type n = last - first;
188
59.6k
        clear();
189
59.6k
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
59.6k
        _size += n;
193
59.6k
        fill(item_ptr(0), first, last);
194
59.6k
    }
195
196
86.6M
    prevector() = default;
prevector<36u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
86.1M
    prevector() = default;
prevector<33u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
504k
    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
327
    prevector() = default;
197
198
    explicit prevector(size_type n) {
199
        resize(n);
200
    }
201
202
453k
    explicit prevector(size_type n, const T& val) {
203
453k
        change_capacity(n);
204
453k
        _size += n;
205
453k
        fill(item_ptr(0), n, val);
206
453k
    }
prevector<33u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
118k
    explicit prevector(size_type n, const T& val) {
203
118k
        change_capacity(n);
204
118k
        _size += n;
205
118k
        fill(item_ptr(0), n, val);
206
118k
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
335k
    explicit prevector(size_type n, const T& val) {
203
335k
        change_capacity(n);
204
335k
        _size += n;
205
335k
        fill(item_ptr(0), n, val);
206
335k
    }
207
208
    template <std::input_iterator InputIterator>
209
1.17M
    prevector(InputIterator first, InputIterator last) {
210
1.17M
        size_type n = last - first;
211
1.17M
        change_capacity(n);
212
1.17M
        _size += n;
213
1.17M
        fill(item_ptr(0), first, last);
214
1.17M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
209
38.3k
    prevector(InputIterator first, InputIterator last) {
210
38.3k
        size_type n = last - first;
211
38.3k
        change_capacity(n);
212
38.3k
        _size += n;
213
38.3k
        fill(item_ptr(0), first, last);
214
38.3k
    }
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
266k
    prevector(InputIterator first, InputIterator last) {
210
266k
        size_type n = last - first;
211
266k
        change_capacity(n);
212
266k
        _size += n;
213
266k
        fill(item_ptr(0), first, last);
214
266k
    }
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
266k
    prevector(InputIterator first, InputIterator last) {
210
266k
        size_type n = last - first;
211
266k
        change_capacity(n);
212
266k
        _size += n;
213
266k
        fill(item_ptr(0), first, last);
214
266k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
209
8.17k
    prevector(InputIterator first, InputIterator last) {
210
8.17k
        size_type n = last - first;
211
8.17k
        change_capacity(n);
212
8.17k
        _size += n;
213
8.17k
        fill(item_ptr(0), first, last);
214
8.17k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
209
221k
    prevector(InputIterator first, InputIterator last) {
210
221k
        size_type n = last - first;
211
221k
        change_capacity(n);
212
221k
        _size += n;
213
221k
        fill(item_ptr(0), first, last);
214
221k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char 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
373k
    prevector(InputIterator first, InputIterator last) {
210
373k
        size_type n = last - first;
211
373k
        change_capacity(n);
212
373k
        _size += n;
213
373k
        fill(item_ptr(0), first, last);
214
373k
    }
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
179
    prevector(InputIterator first, InputIterator last) {
210
179
        size_type n = last - first;
211
179
        change_capacity(n);
212
179
        _size += n;
213
179
        fill(item_ptr(0), first, last);
214
179
    }
215
216
48.2M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
48.2M
        size_type n = other.size();
218
48.2M
        change_capacity(n);
219
48.2M
        _size += n;
220
48.2M
        fill(item_ptr(0), other.begin(),  other.end());
221
48.2M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
1.14M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
1.14M
        size_type n = other.size();
218
1.14M
        change_capacity(n);
219
1.14M
        _size += n;
220
1.14M
        fill(item_ptr(0), other.begin(),  other.end());
221
1.14M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
47.1M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
47.1M
        size_type n = other.size();
218
47.1M
        change_capacity(n);
219
47.1M
        _size += n;
220
47.1M
        fill(item_ptr(0), other.begin(),  other.end());
221
47.1M
    }
222
223
    prevector(prevector<N, T, Size, Diff>&& other) noexcept
224
16.6M
        : _union(std::move(other._union)), _size(other._size)
225
16.6M
    {
226
16.6M
        other._size = 0;
227
16.6M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
29.5k
        : _union(std::move(other._union)), _size(other._size)
225
29.5k
    {
226
29.5k
        other._size = 0;
227
29.5k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
16.6M
        : _union(std::move(other._union)), _size(other._size)
225
16.6M
    {
226
16.6M
        other._size = 0;
227
16.6M
    }
228
229
2.10M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
2.10M
        if (&other == this) {
231
12.9k
            return *this;
232
12.9k
        }
233
2.09M
        assign(other.begin(), other.end());
234
2.09M
        return *this;
235
2.10M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
34.1k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
34.1k
        if (&other == this) {
231
2
            return *this;
232
2
        }
233
34.1k
        assign(other.begin(), other.end());
234
34.1k
        return *this;
235
34.1k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
2.06M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
2.06M
        if (&other == this) {
231
12.9k
            return *this;
232
12.9k
        }
233
2.05M
        assign(other.begin(), other.end());
234
2.05M
        return *this;
235
2.06M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int> const&)
Line
Count
Source
229
8.09k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
8.09k
        if (&other == this) {
231
0
            return *this;
232
0
        }
233
8.09k
        assign(other.begin(), other.end());
234
8.09k
        return *this;
235
8.09k
    }
236
237
32.3M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
32.3M
        if (!is_direct()) {
239
23.4k
            free(_union.indirect_contents.indirect);
240
23.4k
        }
241
32.3M
        _union = std::move(other._union);
242
32.3M
        _size = other._size;
243
32.3M
        other._size = 0;
244
32.3M
        return *this;
245
32.3M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
91.8k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
91.8k
        if (!is_direct()) {
239
8
            free(_union.indirect_contents.indirect);
240
8
        }
241
91.8k
        _union = std::move(other._union);
242
91.8k
        _size = other._size;
243
91.8k
        other._size = 0;
244
91.8k
        return *this;
245
91.8k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
32.2M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
32.2M
        if (!is_direct()) {
239
20.8k
            free(_union.indirect_contents.indirect);
240
20.8k
        }
241
32.2M
        _union = std::move(other._union);
242
32.2M
        _size = other._size;
243
32.2M
        other._size = 0;
244
32.2M
        return *this;
245
32.2M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int>&&)
Line
Count
Source
237
4.09k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
4.09k
        if (!is_direct()) {
239
2.55k
            free(_union.indirect_contents.indirect);
240
2.55k
        }
241
4.09k
        _union = std::move(other._union);
242
4.09k
        _size = other._size;
243
4.09k
        other._size = 0;
244
4.09k
        return *this;
245
4.09k
    }
246
247
2.10G
    size_type size() const {
248
2.10G
        return is_direct() ? _size : _size - N - 1;
249
2.10G
    }
prevector<36u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
2.08G
    size_type size() const {
248
2.08G
        return is_direct() ? _size : _size - N - 1;
249
2.08G
    }
prevector<16u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
9.41M
    size_type size() const {
248
9.41M
        return is_direct() ? _size : _size - N - 1;
249
9.41M
    }
prevector<33u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
372k
    size_type size() const {
248
372k
        return is_direct() ? _size : _size - N - 1;
249
372k
    }
prevector<8u, int, unsigned int, int>::size() const
Line
Count
Source
247
7.18M
    size_type size() const {
248
7.18M
        return is_direct() ? _size : _size - N - 1;
249
7.18M
    }
prevector<4u, Network, unsigned int, int>::size() const
Line
Count
Source
247
1.86k
    size_type size() const {
248
1.86k
        return is_direct() ? _size : _size - N - 1;
249
1.86k
    }
prevector<35u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.25k
    size_type size() const {
248
1.25k
        return is_direct() ? _size : _size - N - 1;
249
1.25k
    }
250
251
35.5M
    bool empty() const {
252
35.5M
        return size() == 0;
253
35.5M
    }
prevector<36u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
35.1M
    bool empty() const {
252
35.1M
        return size() == 0;
253
35.1M
    }
prevector<16u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
100k
    bool empty() const {
252
100k
        return size() == 0;
253
100k
    }
prevector<8u, int, unsigned int, int>::empty() const
Line
Count
Source
251
266k
    bool empty() const {
252
266k
        return size() == 0;
253
266k
    }
prevector<4u, Network, unsigned int, int>::empty() const
Line
Count
Source
251
327
    bool empty() const {
252
327
        return size() == 0;
253
327
    }
254
255
21.1M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
15.9M
    iterator begin() { return iterator(item_ptr(0)); }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::begin()
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::begin()
prevector<8u, int, unsigned int, int>::begin()
Line
Count
Source
255
5.26M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<35u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
358
    iterator begin() { return iterator(item_ptr(0)); }
256
142M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
134M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<16u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
5.70M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<8u, int, unsigned int, int>::begin() const
Line
Count
Source
256
1.87M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
257
41.5M
    iterator end() { return iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
38.1M
    iterator end() { return iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
291k
    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.04M
    iterator end() { return iterator(item_ptr(size())); }
prevector<35u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
358
    iterator end() { return iterator(item_ptr(size())); }
258
1.54G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.54G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.65M
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<8u, int, unsigned int, int>::end() const
Line
Count
Source
258
1.87M
    const_iterator end() const { return const_iterator(item_ptr(size())); }
259
260
19.3M
    size_t capacity() const {
261
19.3M
        if (is_direct()) {
262
13.4M
            return N;
263
13.4M
        } else {
264
5.88M
            return _union.indirect_contents.capacity;
265
5.88M
        }
266
19.3M
    }
prevector<36u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
19.0M
    size_t capacity() const {
261
19.0M
        if (is_direct()) {
262
13.1M
            return N;
263
13.1M
        } else {
264
5.82M
            return _union.indirect_contents.capacity;
265
5.82M
        }
266
19.0M
    }
prevector<16u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
104k
    size_t capacity() const {
261
104k
        if (is_direct()) {
262
104k
            return N;
263
104k
        } else {
264
10
            return _union.indirect_contents.capacity;
265
10
        }
266
104k
    }
prevector<8u, int, unsigned int, int>::capacity() const
Line
Count
Source
260
92.3k
    size_t capacity() const {
261
92.3k
        if (is_direct()) {
262
33.4k
            return N;
263
58.9k
        } else {
264
58.9k
            return _union.indirect_contents.capacity;
265
58.9k
        }
266
92.3k
    }
prevector<4u, Network, unsigned int, int>::capacity() const
Line
Count
Source
260
605
    size_t capacity() const {
261
605
        if (is_direct()) {
262
605
            return N;
263
605
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
605
    }
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
358
    size_t capacity() const {
261
358
        if (is_direct()) {
262
358
            return N;
263
358
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
358
    }
267
268
11.1M
    T& operator[](size_type pos) {
269
11.1M
        return *item_ptr(pos);
270
11.1M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
2.15M
    T& operator[](size_type pos) {
269
2.15M
        return *item_ptr(pos);
270
2.15M
    }
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.72M
    T& operator[](size_type pos) {
269
8.72M
        return *item_ptr(pos);
270
8.72M
    }
prevector<4u, Network, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
327
    T& operator[](size_type pos) {
269
327
        return *item_ptr(pos);
270
327
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
5.31k
    T& operator[](size_type pos) {
269
5.31k
        return *item_ptr(pos);
270
5.31k
    }
271
272
18.1M
    const T& operator[](size_type pos) const {
273
18.1M
        return *item_ptr(pos);
274
18.1M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
11.0M
    const T& operator[](size_type pos) const {
273
11.0M
        return *item_ptr(pos);
274
11.0M
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
7.16M
    const T& operator[](size_type pos) const {
273
7.16M
        return *item_ptr(pos);
274
7.16M
    }
275
276
85.0M
    void resize(size_type new_size) {
277
85.0M
        size_type cur_size = size();
278
85.0M
        if (cur_size == new_size) {
279
73.0M
            return;
280
73.0M
        }
281
11.9M
        if (cur_size > new_size) {
282
11.4M
            erase(item_ptr(new_size), end());
283
11.4M
            return;
284
11.4M
        }
285
585k
        if (new_size > capacity()) {
286
83.3k
            change_capacity(new_size);
287
83.3k
        }
288
585k
        ptrdiff_t increase = new_size - cur_size;
289
585k
        fill(item_ptr(cur_size), increase);
290
585k
        _size += increase;
291
585k
    }
prevector<36u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
84.7M
    void resize(size_type new_size) {
277
84.7M
        size_type cur_size = size();
278
84.7M
        if (cur_size == new_size) {
279
73.0M
            return;
280
73.0M
        }
281
11.7M
        if (cur_size > new_size) {
282
11.2M
            erase(item_ptr(new_size), end());
283
11.2M
            return;
284
11.2M
        }
285
450k
        if (new_size > capacity()) {
286
82.7k
            change_capacity(new_size);
287
82.7k
        }
288
450k
        ptrdiff_t increase = new_size - cur_size;
289
450k
        fill(item_ptr(cur_size), increase);
290
450k
        _size += increase;
291
450k
    }
prevector<16u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
146k
    void resize(size_type new_size) {
277
146k
        size_type cur_size = size();
278
146k
        if (cur_size == new_size) {
279
101
            return;
280
101
        }
281
146k
        if (cur_size > new_size) {
282
145k
            erase(item_ptr(new_size), end());
283
145k
            return;
284
145k
        }
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
28.8k
    void resize(size_type new_size) {
277
28.8k
        size_type cur_size = size();
278
28.8k
        if (cur_size == new_size) {
279
10.2k
            return;
280
10.2k
        }
281
18.6k
        if (cur_size > new_size) {
282
12.0k
            erase(item_ptr(new_size), end());
283
12.0k
            return;
284
12.0k
        }
285
6.57k
        if (new_size > capacity()) {
286
279
            change_capacity(new_size);
287
279
        }
288
6.57k
        ptrdiff_t increase = new_size - cur_size;
289
6.57k
        fill(item_ptr(cur_size), increase);
290
6.57k
        _size += increase;
291
6.57k
    }
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
3.99k
    void reserve(size_type new_capacity) {
294
3.99k
        if (new_capacity > capacity()) {
295
1.81k
            change_capacity(new_capacity);
296
1.81k
        }
297
3.99k
    }
298
299
80.7M
    void shrink_to_fit() {
300
80.7M
        change_capacity(size());
301
80.7M
    }
prevector<36u, unsigned char, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
80.7M
    void shrink_to_fit() {
300
80.7M
        change_capacity(size());
301
80.7M
    }
prevector<8u, int, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
1.97k
    void shrink_to_fit() {
300
1.97k
        change_capacity(size());
301
1.97k
    }
302
303
84.4M
    void clear() {
304
84.4M
        resize(0);
305
84.4M
    }
prevector<36u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
84.2M
    void clear() {
304
84.2M
        resize(0);
305
84.2M
    }
prevector<16u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
104k
    void clear() {
304
104k
        resize(0);
305
104k
    }
prevector<8u, int, unsigned int, int>::clear()
Line
Count
Source
303
12.6k
    void clear() {
304
12.6k
        resize(0);
305
12.6k
    }
306
307
9.65M
    iterator insert(iterator pos, const T& value) {
308
9.65M
        size_type p = pos - begin();
309
9.65M
        size_type new_size = size() + 1;
310
9.65M
        if (capacity() < new_size) {
311
8.09k
            change_capacity(new_size + (new_size >> 1));
312
8.09k
        }
313
9.65M
        T* ptr = item_ptr(p);
314
9.65M
        T* dst = ptr + 1;
315
9.65M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.65M
        _size++;
317
9.65M
        new(static_cast<void*>(ptr)) T(value);
318
9.65M
        return iterator(ptr);
319
9.65M
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const&)
Line
Count
Source
307
9.62M
    iterator insert(iterator pos, const T& value) {
308
9.62M
        size_type p = pos - begin();
309
9.62M
        size_type new_size = size() + 1;
310
9.62M
        if (capacity() < new_size) {
311
6.65k
            change_capacity(new_size + (new_size >> 1));
312
6.65k
        }
313
9.62M
        T* ptr = item_ptr(p);
314
9.62M
        T* dst = ptr + 1;
315
9.62M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.62M
        _size++;
317
9.62M
        new(static_cast<void*>(ptr)) T(value);
318
9.62M
        return iterator(ptr);
319
9.62M
    }
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.43k
            change_capacity(new_size + (new_size >> 1));
312
1.43k
        }
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.1k
    void insert(iterator pos, size_type count, const T& value) {
322
16.1k
        size_type p = pos - begin();
323
16.1k
        size_type new_size = size() + count;
324
16.1k
        if (capacity() < new_size) {
325
767
            change_capacity(new_size + (new_size >> 1));
326
767
        }
327
16.1k
        T* ptr = item_ptr(p);
328
16.1k
        T* dst = ptr + count;
329
16.1k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.1k
        _size += count;
331
16.1k
        fill(item_ptr(p), count, value);
332
16.1k
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, unsigned int, int const&)
Line
Count
Source
321
16.1k
    void insert(iterator pos, size_type count, const T& value) {
322
16.1k
        size_type p = pos - begin();
323
16.1k
        size_type new_size = size() + count;
324
16.1k
        if (capacity() < new_size) {
325
760
            change_capacity(new_size + (new_size >> 1));
326
760
        }
327
16.1k
        T* ptr = item_ptr(p);
328
16.1k
        T* dst = ptr + count;
329
16.1k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.1k
        _size += count;
331
16.1k
        fill(item_ptr(p), count, value);
332
16.1k
    }
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.59M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
5.59M
        size_type p = pos - begin();
337
5.59M
        difference_type count = last - first;
338
5.59M
        size_type new_size = size() + count;
339
5.59M
        if (capacity() < new_size) {
340
375k
            change_capacity(new_size + (new_size >> 1));
341
375k
        }
342
5.59M
        T* ptr = item_ptr(p);
343
5.59M
        T* dst = ptr + count;
344
5.59M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
5.59M
        _size += count;
346
5.59M
        fill(ptr, first, last);
347
5.59M
    }
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.79M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.79M
        size_type p = pos - begin();
337
2.79M
        difference_type count = last - first;
338
2.79M
        size_type new_size = size() + count;
339
2.79M
        if (capacity() < new_size) {
340
229k
            change_capacity(new_size + (new_size >> 1));
341
229k
        }
342
2.79M
        T* ptr = item_ptr(p);
343
2.79M
        T* dst = ptr + count;
344
2.79M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.79M
        _size += count;
346
2.79M
        fill(ptr, first, last);
347
2.79M
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
335
23.0k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
23.0k
        size_type p = pos - begin();
337
23.0k
        difference_type count = last - first;
338
23.0k
        size_type new_size = size() + count;
339
23.0k
        if (capacity() < new_size) {
340
17.3k
            change_capacity(new_size + (new_size >> 1));
341
17.3k
        }
342
23.0k
        T* ptr = item_ptr(p);
343
23.0k
        T* dst = ptr + count;
344
23.0k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
23.0k
        _size += count;
346
23.0k
        fill(ptr, first, last);
347
23.0k
    }
void prevector<8u, int, unsigned int, int>::insert<int*>(prevector<8u, int, unsigned int, int>::iterator, int*, int*)
Line
Count
Source
335
4.10k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
4.10k
        size_type p = pos - begin();
337
4.10k
        difference_type count = last - first;
338
4.10k
        size_type new_size = size() + count;
339
4.10k
        if (capacity() < new_size) {
340
330
            change_capacity(new_size + (new_size >> 1));
341
330
        }
342
4.10k
        T* ptr = item_ptr(p);
343
4.10k
        T* dst = ptr + count;
344
4.10k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
4.10k
        _size += count;
346
4.10k
        fill(ptr, first, last);
347
4.10k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(prevector<36u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
335
2.75k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.75k
        size_type p = pos - begin();
337
2.75k
        difference_type count = last - first;
338
2.75k
        size_type new_size = size() + count;
339
2.75k
        if (capacity() < new_size) {
340
240
            change_capacity(new_size + (new_size >> 1));
341
240
        }
342
2.75k
        T* ptr = item_ptr(p);
343
2.75k
        T* dst = ptr + count;
344
2.75k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.75k
        _size += count;
346
2.75k
        fill(ptr, first, last);
347
2.75k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
335
2.76M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.76M
        size_type p = pos - begin();
337
2.76M
        difference_type count = last - first;
338
2.76M
        size_type new_size = size() + count;
339
2.76M
        if (capacity() < new_size) {
340
128k
            change_capacity(new_size + (new_size >> 1));
341
128k
        }
342
2.76M
        T* ptr = item_ptr(p);
343
2.76M
        T* dst = ptr + count;
344
2.76M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.76M
        _size += count;
346
2.76M
        fill(ptr, first, last);
347
2.76M
    }
void prevector<35u, unsigned char, unsigned int, int>::insert<unsigned char*>(prevector<35u, unsigned char, unsigned int, int>::iterator, unsigned char*, unsigned char*)
Line
Count
Source
335
179
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
179
        size_type p = pos - begin();
337
179
        difference_type count = last - first;
338
179
        size_type new_size = size() + count;
339
179
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
179
        T* ptr = item_ptr(p);
343
179
        T* dst = ptr + count;
344
179
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
179
        _size += count;
346
179
        fill(ptr, first, last);
347
179
    }
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
179
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
179
        size_type p = pos - begin();
337
179
        difference_type count = last - first;
338
179
        size_type new_size = size() + count;
339
179
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
179
        T* ptr = item_ptr(p);
343
179
        T* dst = ptr + count;
344
179
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
179
        _size += count;
346
179
        fill(ptr, first, last);
347
179
    }
348
349
1.08M
    inline void resize_uninitialized(size_type new_size) {
350
        // resize_uninitialized changes the size of the prevector but does not initialize it.
351
        // If size < new_size, the added elements must be initialized explicitly.
352
1.08M
        if (capacity() < new_size) {
353
236k
            change_capacity(new_size);
354
236k
            _size += new_size - size();
355
236k
            return;
356
236k
        }
357
844k
        if (new_size < size()) {
358
3.16k
            erase(item_ptr(new_size), end());
359
841k
        } else {
360
841k
            _size += new_size - size();
361
841k
        }
362
844k
    }
prevector<36u, unsigned char, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
1.07M
    inline void resize_uninitialized(size_type new_size) {
350
        // resize_uninitialized changes the size of the prevector but does not initialize it.
351
        // If size < new_size, the added elements must be initialized explicitly.
352
1.07M
        if (capacity() < new_size) {
353
235k
            change_capacity(new_size);
354
235k
            _size += new_size - size();
355
235k
            return;
356
235k
        }
357
837k
        if (new_size < size()) {
358
0
            erase(item_ptr(new_size), end());
359
837k
        } else {
360
837k
            _size += new_size - size();
361
837k
        }
362
837k
    }
prevector<8u, int, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
8.09k
    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.09k
        if (capacity() < new_size) {
353
1.12k
            change_capacity(new_size);
354
1.12k
            _size += new_size - size();
355
1.12k
            return;
356
1.12k
        }
357
6.97k
        if (new_size < size()) {
358
3.16k
            erase(item_ptr(new_size), end());
359
3.80k
        } else {
360
3.80k
            _size += new_size - size();
361
3.80k
        }
362
6.97k
    }
363
364
27.8k
    iterator erase(iterator pos) {
365
27.8k
        return erase(pos, pos + 1);
366
27.8k
    }
367
368
11.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
11.4M
        iterator p = first;
376
11.4M
        char* endp = (char*)&(*end());
377
11.4M
        _size -= last - p;
378
11.4M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
11.4M
        return first;
380
11.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
11.2M
    iterator erase(iterator first, iterator last) {
369
        // Erase is not allowed to the change the object's capacity. That means
370
        // that when starting with an indirectly allocated prevector with
371
        // size and capacity > N, the result may be a still indirectly allocated
372
        // prevector with size <= N and capacity > N. A shrink_to_fit() call is
373
        // necessary to switch to the (more efficient) directly allocated
374
        // representation (with capacity N and size <= N).
375
11.2M
        iterator p = first;
376
11.2M
        char* endp = (char*)&(*end());
377
11.2M
        _size -= last - p;
378
11.2M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
11.2M
        return first;
380
11.2M
    }
prevector<16u, unsigned char, unsigned int, int>::erase(prevector<16u, unsigned char, unsigned int, int>::iterator, prevector<16u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
368
145k
    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
145k
        iterator p = first;
376
145k
        char* endp = (char*)&(*end());
377
145k
        _size -= last - p;
378
145k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
145k
        return first;
380
145k
    }
prevector<8u, int, unsigned int, int>::erase(prevector<8u, int, unsigned int, int>::iterator, prevector<8u, int, unsigned int, int>::iterator)
Line
Count
Source
368
70.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
70.2k
        iterator p = first;
376
70.2k
        char* endp = (char*)&(*end());
377
70.2k
        _size -= last - p;
378
70.2k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
70.2k
        return first;
380
70.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
82.1k
    void emplace_back(Args&&... args) {
384
82.1k
        size_type new_size = size() + 1;
385
82.1k
        if (capacity() < new_size) {
386
13.3k
            change_capacity(new_size + (new_size >> 1));
387
13.3k
        }
388
82.1k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
82.1k
        _size++;
390
82.1k
    }
void prevector<36u, unsigned char, unsigned int, int>::emplace_back<unsigned char const&>(unsigned char const&)
Line
Count
Source
383
73.3k
    void emplace_back(Args&&... args) {
384
73.3k
        size_type new_size = size() + 1;
385
73.3k
        if (capacity() < new_size) {
386
13.0k
            change_capacity(new_size + (new_size >> 1));
387
13.0k
        }
388
73.3k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
73.3k
        _size++;
390
73.3k
    }
void prevector<8u, int, unsigned int, int>::emplace_back<int const&>(int const&)
Line
Count
Source
383
8.21k
    void emplace_back(Args&&... args) {
384
8.21k
        size_type new_size = size() + 1;
385
8.21k
        if (capacity() < new_size) {
386
248
            change_capacity(new_size + (new_size >> 1));
387
248
        }
388
8.21k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
8.21k
        _size++;
390
8.21k
    }
void prevector<4u, Network, unsigned int, int>::emplace_back<Network const&>(Network const&)
Line
Count
Source
383
605
    void emplace_back(Args&&... args) {
384
605
        size_type new_size = size() + 1;
385
605
        if (capacity() < new_size) {
386
0
            change_capacity(new_size + (new_size >> 1));
387
0
        }
388
605
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
605
        _size++;
390
605
    }
391
392
82.1k
    void push_back(const T& value) {
393
82.1k
        emplace_back(value);
394
82.1k
    }
prevector<36u, unsigned char, unsigned int, int>::push_back(unsigned char const&)
Line
Count
Source
392
73.3k
    void push_back(const T& value) {
393
73.3k
        emplace_back(value);
394
73.3k
    }
prevector<8u, int, unsigned int, int>::push_back(int const&)
Line
Count
Source
392
8.21k
    void push_back(const T& value) {
393
8.21k
        emplace_back(value);
394
8.21k
    }
prevector<4u, Network, unsigned int, int>::push_back(Network const&)
Line
Count
Source
392
605
    void push_back(const T& value) {
393
605
        emplace_back(value);
394
605
    }
395
396
6.87k
    void pop_back() {
397
6.87k
        erase(end() - 1, end());
398
6.87k
    }
399
400
    T& front() {
401
        return *item_ptr(0);
402
    }
403
404
    const T& front() const {
405
        return *item_ptr(0);
406
    }
407
408
    T& back() {
409
        return *item_ptr(size() - 1);
410
    }
411
412
28.1k
    const T& back() const {
413
28.1k
        return *item_ptr(size() - 1);
414
28.1k
    }
415
416
    void swap(prevector<N, T, Size, Diff>& other) noexcept
417
16.4k
    {
418
16.4k
        std::swap(_union, other._union);
419
16.4k
        std::swap(_size, other._size);
420
16.4k
    }
421
422
153M
    ~prevector() {
423
153M
        if (!is_direct()) {
424
2.28M
            free(_union.indirect_contents.indirect);
425
2.28M
            _union.indirect_contents.indirect = nullptr;
426
2.28M
        }
427
153M
    }
prevector<16u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
1.49M
    ~prevector() {
423
1.49M
        if (!is_direct()) {
424
2.11k
            free(_union.indirect_contents.indirect);
425
2.11k
            _union.indirect_contents.indirect = nullptr;
426
2.11k
        }
427
1.49M
    }
prevector<36u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
150M
    ~prevector() {
423
150M
        if (!is_direct()) {
424
2.08M
            free(_union.indirect_contents.indirect);
425
2.08M
            _union.indirect_contents.indirect = nullptr;
426
2.08M
        }
427
150M
    }
prevector<33u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
622k
    ~prevector() {
423
622k
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
622k
    }
prevector<8u, int, unsigned int, int>::~prevector()
Line
Count
Source
422
533k
    ~prevector() {
423
533k
        if (!is_direct()) {
424
204k
            free(_union.indirect_contents.indirect);
425
204k
            _union.indirect_contents.indirect = nullptr;
426
204k
        }
427
533k
    }
prevector<4u, Network, unsigned int, int>::~prevector()
Line
Count
Source
422
327
    ~prevector() {
423
327
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
327
    }
prevector<35u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
179
    ~prevector() {
423
179
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
179
    }
428
429
7.22M
    constexpr bool operator==(const prevector& other) const {
430
7.22M
        return std::ranges::equal(*this, other);
431
7.22M
    }
prevector<36u, unsigned char, unsigned int, int>::operator==(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
6.47M
    constexpr bool operator==(const prevector& other) const {
430
6.47M
        return std::ranges::equal(*this, other);
431
6.47M
    }
prevector<8u, int, unsigned int, int>::operator==(prevector<8u, int, unsigned int, int> const&) const
Line
Count
Source
429
533k
    constexpr bool operator==(const prevector& other) const {
430
533k
        return std::ranges::equal(*this, other);
431
533k
    }
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
22.7M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
22.7M
        if (size() < other.size()) {
435
896k
            return true;
436
896k
        }
437
21.8M
        if (size() > other.size()) {
438
310k
            return false;
439
310k
        }
440
21.5M
        const_iterator b1 = begin();
441
21.5M
        const_iterator b2 = other.begin();
442
21.5M
        const_iterator e1 = end();
443
132M
        while (b1 != e1) {
444
130M
            if ((*b1) < (*b2)) {
445
10.8M
                return true;
446
10.8M
            }
447
119M
            if ((*b2) < (*b1)) {
448
8.24M
                return false;
449
8.24M
            }
450
111M
            ++b1;
451
111M
            ++b2;
452
111M
        }
453
2.50M
        return false;
454
21.5M
    }
prevector<36u, unsigned char, unsigned int, int>::operator<(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
22.7M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
22.7M
        if (size() < other.size()) {
435
896k
            return true;
436
896k
        }
437
21.8M
        if (size() > other.size()) {
438
310k
            return false;
439
310k
        }
440
21.5M
        const_iterator b1 = begin();
441
21.5M
        const_iterator b2 = other.begin();
442
21.5M
        const_iterator e1 = end();
443
132M
        while (b1 != e1) {
444
130M
            if ((*b1) < (*b2)) {
445
10.8M
                return true;
446
10.8M
            }
447
119M
            if ((*b2) < (*b1)) {
448
8.24M
                return false;
449
8.24M
            }
450
110M
            ++b1;
451
110M
            ++b2;
452
110M
        }
453
2.47M
        return false;
454
21.5M
    }
prevector<16u, unsigned char, unsigned int, int>::operator<(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
27.1k
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
27.1k
        if (size() < other.size()) {
435
0
            return true;
436
0
        }
437
27.1k
        if (size() > other.size()) {
438
0
            return false;
439
0
        }
440
27.1k
        const_iterator b1 = begin();
441
27.1k
        const_iterator b2 = other.begin();
442
27.1k
        const_iterator e1 = end();
443
136k
        while (b1 != e1) {
444
110k
            if ((*b1) < (*b2)) {
445
235
                return true;
446
235
            }
447
109k
            if ((*b2) < (*b1)) {
448
82
                return false;
449
82
            }
450
109k
            ++b1;
451
109k
            ++b2;
452
109k
        }
453
26.8k
        return false;
454
27.1k
    }
455
456
43.5M
    size_t allocated_memory() const {
457
43.5M
        if (is_direct()) {
458
42.6M
            return 0;
459
42.6M
        } else {
460
876k
            return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity;
461
876k
        }
462
43.5M
    }
463
464
607k
    value_type* data() {
465
607k
        return item_ptr(0);
466
607k
    }
prevector<16u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
42.2k
    value_type* data() {
465
42.2k
        return item_ptr(0);
466
42.2k
    }
prevector<33u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
245k
    value_type* data() {
465
245k
        return item_ptr(0);
466
245k
    }
prevector<36u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
319k
    value_type* data() {
465
319k
        return item_ptr(0);
466
319k
    }
prevector<35u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
179
    value_type* data() {
465
179
        return item_ptr(0);
466
179
    }
467
468
35.1M
    const value_type* data() const {
469
35.1M
        return item_ptr(0);
470
35.1M
    }
prevector<36u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
32.7M
    const value_type* data() const {
469
32.7M
        return item_ptr(0);
470
32.7M
    }
prevector<16u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
2.22M
    const value_type* data() const {
469
2.22M
        return item_ptr(0);
470
2.22M
    }
prevector<33u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
118k
    const value_type* data() const {
469
118k
        return item_ptr(0);
470
118k
    }
471
};
472
473
#endif // BITCOIN_PREVECTOR_H