Coverage Report

Created: 2026-07-08 14:14

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.0M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
75.3M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
430k
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::iterator::iterator(int*)
Line
Count
Source
60
14.2M
        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
692
        iterator(T* ptr_) : ptr(ptr_) {}
61
152M
        T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
140M
        T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
861k
        T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
11.2M
        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
692
        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.03M
        T& operator[](size_type pos) const { return ptr[pos]; }
64
41.7M
        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.06M
        iterator& operator++() { ptr++; return *this; }
65
4.06M
        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.1M
        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.6M
        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
143k
        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
389k
        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
346
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
69
4.20M
        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.03M
        iterator operator-(size_type n) const { return iterator(ptr - n); }
73
        iterator& operator-=(size_type n) { ptr -= n; return *this; }
74
44.7M
        bool operator==(iterator x) const { return ptr == x.ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator==(prevector<36u, unsigned char, unsigned int, int>::iterator) const
Line
Count
Source
74
37.9M
        bool operator==(iterator x) const { return ptr == x.ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator==(prevector<8u, int, unsigned int, int>::iterator) const
Line
Count
Source
74
6.88M
        bool operator==(iterator x) const { return ptr == x.ptr; }
75
0
        auto operator<=>(iterator x) const { return ptr <=> x.ptr; }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<16u, unsigned char, unsigned int, int>::iterator) const
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<33u, unsigned char, unsigned int, int>::iterator) const
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<36u, unsigned char, unsigned int, int>::iterator) const
Unexecuted instantiation: prevector<8u, int, unsigned int, int>::iterator::operator<=>(prevector<8u, int, unsigned int, int>::iterator) const
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<35u, unsigned char, unsigned int, int>::iterator) const
76
    };
77
78
    class const_iterator {
79
        const T* ptr{};
80
    public:
81
        typedef Diff difference_type;
82
        typedef const T* pointer;
83
        typedef const T& reference;
84
        using element_type = const T;
85
        using iterator_category = std::contiguous_iterator_tag;
86
        const_iterator() = default;
87
1.59G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::const_iterator::const_iterator(unsigned char const*)
Line
Count
Source
87
7.71M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::const_iterator::const_iterator(unsigned char const*)
Line
Count
Source
87
1.58G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::const_iterator::const_iterator(int const*)
Line
Count
Source
87
3.74M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
88
737k
        const_iterator(iterator x) : ptr(&(*x)) {}
89
17.9G
        const T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
17.9G
        const T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
12.4M
        const T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
16.4M
        const T& operator*() const { return *ptr; }
90
3.91M
        const T* operator->() const { return ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
3.91M
        const T* operator->() const { return ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
478
        const T* operator->() const { return ptr; }
91
179k
        const T& operator[](size_type pos) const { return ptr[pos]; }
92
16.1G
        const_iterator& operator++() { ptr++; return *this; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
16.1G
        const_iterator& operator++() { ptr++; return *this; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
7.03M
        const_iterator& operator++() { ptr++; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
12.2M
        const_iterator& operator++() { ptr++; return *this; }
93
4.06M
        const_iterator& operator--() { ptr--; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator--()
Line
Count
Source
93
4.06M
        const_iterator& operator--() { ptr--; return *this; }
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator--()
94
692M
        const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
95
        const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
96
742M
        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
741M
        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
471k
        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.33M
        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.3G
        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
8.01M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator==(prevector<8u, int, unsigned int, int>::const_iterator) const
Line
Count
Source
102
11.5M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
103
1.37G
        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.37G
        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
123M
    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
117M
    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.23M
    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
750k
    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.91M
    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
819
    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.38k
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
123
289M
    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
268M
    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
18.8M
    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.60M
    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
34.6M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
20.4M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
2.26k
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::indirect_ptr(int)
prevector<8u, int, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
14.1M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
Unexecuted instantiation: prevector<4u, Network, unsigned int, int>::indirect_ptr(int)
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::indirect_ptr(int)
125
1.35G
    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.35G
    const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int) const
Line
Count
Source
125
5.55k
    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.13M
    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.19G
    bool is_direct() const { return _size <= N; }
prevector<36u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.12G
    bool is_direct() const { return _size <= N; }
prevector<16u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
35.6M
    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
28.8M
    bool is_direct() const { return _size <= N; }
prevector<4u, Network, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.27k
    bool is_direct() const { return _size <= N; }
prevector<35u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.28k
    bool is_direct() const { return _size <= N; }
127
128
137M
    void change_capacity(size_type new_capacity) {
129
137M
        if (new_capacity <= N) {
130
134M
            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
134M
        } else {
139
2.42M
            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
82.8k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
82.8k
                assert(_union.indirect_contents.indirect);
145
82.8k
                _union.indirect_contents.capacity = new_capacity;
146
2.34M
            } else {
147
2.34M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.34M
                assert(new_indirect);
149
2.34M
                T* src = direct_ptr(0);
150
2.34M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.34M
                memcpy(dst, src, size() * sizeof(T));
152
2.34M
                _union.indirect_contents.indirect = new_indirect;
153
2.34M
                _union.indirect_contents.capacity = new_capacity;
154
2.34M
                _size += N + 1;
155
2.34M
            }
156
2.42M
        }
157
137M
    }
prevector<36u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
134M
    void change_capacity(size_type new_capacity) {
129
134M
        if (new_capacity <= N) {
130
132M
            if (!is_direct()) {
131
44.5k
                T* indirect = indirect_ptr(0);
132
44.5k
                T* src = indirect;
133
44.5k
                T* dst = direct_ptr(0);
134
44.5k
                memcpy(dst, src, size() * sizeof(T));
135
44.5k
                free(indirect);
136
44.5k
                _size -= N + 1;
137
44.5k
            }
138
132M
        } 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.6k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
78.6k
                assert(_union.indirect_contents.indirect);
145
78.6k
                _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
134M
    }
prevector<16u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
1.65M
    void change_capacity(size_type new_capacity) {
129
1.65M
        if (new_capacity <= N) {
130
1.65M
            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.65M
        } else {
139
1.94k
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
0
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
0
                assert(_union.indirect_contents.indirect);
145
0
                _union.indirect_contents.capacity = new_capacity;
146
1.94k
            } else {
147
1.94k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
1.94k
                assert(new_indirect);
149
1.94k
                T* src = direct_ptr(0);
150
1.94k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
1.94k
                memcpy(dst, src, size() * sizeof(T));
152
1.94k
                _union.indirect_contents.indirect = new_indirect;
153
1.94k
                _union.indirect_contents.capacity = new_capacity;
154
1.94k
                _size += N + 1;
155
1.94k
            }
156
1.94k
        }
157
1.65M
    }
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
540k
    void change_capacity(size_type new_capacity) {
129
540k
        if (new_capacity <= N) {
130
337k
            if (!is_direct()) {
131
665
                T* indirect = indirect_ptr(0);
132
665
                T* src = indirect;
133
665
                T* dst = direct_ptr(0);
134
665
                memcpy(dst, src, size() * sizeof(T));
135
665
                free(indirect);
136
665
                _size -= N + 1;
137
665
            }
138
337k
        } else {
139
203k
            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.16k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
4.16k
                assert(_union.indirect_contents.indirect);
145
4.16k
                _union.indirect_contents.capacity = new_capacity;
146
198k
            } else {
147
198k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
198k
                assert(new_indirect);
149
198k
                T* src = direct_ptr(0);
150
198k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
198k
                memcpy(dst, src, size() * sizeof(T));
152
198k
                _union.indirect_contents.indirect = new_indirect;
153
198k
                _union.indirect_contents.capacity = new_capacity;
154
198k
                _size += N + 1;
155
198k
            }
156
203k
        }
157
540k
    }
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
173
    void change_capacity(size_type new_capacity) {
129
173
        if (new_capacity <= N) {
130
173
            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
173
        } 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
173
    }
158
159
155M
    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
135M
    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.23M
    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
750k
    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
16.8M
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<4u, Network, unsigned int, int>::item_ptr(int)
Line
Count
Source
159
819
    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.38k
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
160
1.64G
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<36u, unsigned char, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
1.62G
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<16u, unsigned char, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
18.8M
    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.74M
    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.18M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
1.18M
        std::fill_n(dst, count, value);
164
1.18M
    }
prevector<36u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
585k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
585k
        std::fill_n(dst, count, value);
164
585k
    }
prevector<16u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
328k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
328k
        std::fill_n(dst, count, value);
164
328k
    }
prevector<33u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
246k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
246k
        std::fill_n(dst, count, value);
164
246k
    }
prevector<8u, int, unsigned int, int>::fill(int*, long, int const&)
Line
Count
Source
162
23.1k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
23.1k
        std::fill_n(dst, count, value);
164
23.1k
    }
165
166
    template <std::input_iterator InputIterator>
167
59.0M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.3G
        while (first != last) {
169
15.3G
            new(static_cast<void*>(dst)) T(*first);
170
15.3G
            ++dst;
171
15.3G
            ++first;
172
15.3G
        }
173
59.0M
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
393
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.42k
        while (first != last) {
169
1.02k
            new(static_cast<void*>(dst)) T(*first);
170
1.02k
            ++dst;
171
1.02k
            ++first;
172
1.02k
        }
173
393
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
167
2.71M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
89.9M
        while (first != last) {
169
87.2M
            new(static_cast<void*>(dst)) T(*first);
170
87.2M
            ++dst;
171
87.2M
            ++first;
172
87.2M
        }
173
2.71M
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<prevector<16u, unsigned char, unsigned int, int>::const_iterator>(unsigned char*, prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
167
1.36M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
7.11M
        while (first != last) {
169
5.75M
            new(static_cast<void*>(dst)) T(*first);
170
5.75M
            ++dst;
171
5.75M
            ++first;
172
5.75M
        }
173
1.36M
    }
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
54.1M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.1G
        while (first != last) {
169
15.1G
            new(static_cast<void*>(dst)) T(*first);
170
15.1G
            ++dst;
171
15.1G
            ++first;
172
15.1G
        }
173
54.1M
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
40.7k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.65M
        while (first != last) {
169
1.61M
            new(static_cast<void*>(dst)) T(*first);
170
1.61M
            ++dst;
171
1.61M
            ++first;
172
1.61M
        }
173
40.7k
    }
void prevector<33u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
1
    void fill(T* dst, InputIterator first, InputIterator last) {
168
33
        while (first != last) {
169
32
            new(static_cast<void*>(dst)) T(*first);
170
32
            ++dst;
171
32
            ++first;
172
32
        }
173
1
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<prevector<36u, unsigned char, unsigned int, int>::iterator>(unsigned char*, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
167
22.8k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
37.3M
        while (first != last) {
169
37.3M
            new(static_cast<void*>(dst)) T(*first);
170
37.3M
            ++dst;
171
37.3M
            ++first;
172
37.3M
        }
173
22.8k
    }
void prevector<8u, int, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>>(int*, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>)
Line
Count
Source
167
266k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.29M
        while (first != last) {
169
2.03M
            new(static_cast<void*>(dst)) T(*first);
170
2.03M
            ++dst;
171
2.03M
            ++first;
172
2.03M
        }
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.29M
        while (first != last) {
169
2.03M
            new(static_cast<void*>(dst)) T(*first);
170
2.03M
            ++dst;
171
2.03M
            ++first;
172
2.03M
        }
173
266k
    }
void prevector<8u, int, unsigned int, int>::fill<int*>(int*, int*, int*)
Line
Count
Source
167
4.09k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
14.2k
        while (first != last) {
169
10.1k
            new(static_cast<void*>(dst)) T(*first);
170
10.1k
            ++dst;
171
10.1k
            ++first;
172
10.1k
        }
173
4.09k
    }
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.29k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
54.0k
        while (first != last) {
169
45.7k
            new(static_cast<void*>(dst)) T(*first);
170
45.7k
            ++dst;
171
45.7k
            ++first;
172
45.7k
        }
173
8.29k
    }
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
214k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
31.4M
        while (first != last) {
169
31.2M
            new(static_cast<void*>(dst)) T(*first);
170
31.2M
            ++dst;
171
31.2M
            ++first;
172
31.2M
        }
173
214k
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>)
Line
Count
Source
167
7
    void fill(T* dst, InputIterator first, InputIterator last) {
168
35
        while (first != last) {
169
28
            new(static_cast<void*>(dst)) T(*first);
170
28
            ++dst;
171
28
            ++first;
172
28
        }
173
7
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>)
Line
Count
Source
167
4
    void fill(T* dst, InputIterator first, InputIterator last) {
168
36
        while (first != last) {
169
32
            new(static_cast<void*>(dst)) T(*first);
170
32
            ++dst;
171
32
            ++first;
172
32
        }
173
4
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>)
Line
Count
Source
167
6
    void fill(T* dst, InputIterator first, InputIterator last) {
168
12
        while (first != last) {
169
6
            new(static_cast<void*>(dst)) T(*first);
170
6
            ++dst;
171
6
            ++first;
172
6
        }
173
6
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
12
        while (first != last) {
169
10
            new(static_cast<void*>(dst)) T(*first);
170
10
            ++dst;
171
10
            ++first;
172
10
        }
173
2
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>)
Line
Count
Source
167
7
    void fill(T* dst, InputIterator first, InputIterator last) {
168
28
        while (first != last) {
169
21
            new(static_cast<void*>(dst)) T(*first);
170
21
            ++dst;
171
21
            ++first;
172
21
        }
173
7
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
16
        while (first != last) {
169
14
            new(static_cast<void*>(dst)) T(*first);
170
14
            ++dst;
171
14
            ++first;
172
14
        }
173
2
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
52
        while (first != last) {
169
50
            new(static_cast<void*>(dst)) T(*first);
170
50
            ++dst;
171
50
            ++first;
172
50
        }
173
2
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
167
10.0k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
91.5k
        while (first != last) {
169
81.5k
            new(static_cast<void*>(dst)) T(*first);
170
81.5k
            ++dst;
171
81.5k
            ++first;
172
81.5k
        }
173
10.0k
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
10
    void fill(T* dst, InputIterator first, InputIterator last) {
168
110
        while (first != last) {
169
100
            new(static_cast<void*>(dst)) T(*first);
170
100
            ++dst;
171
100
            ++first;
172
100
        }
173
10
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
41
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.35k
        while (first != last) {
169
1.31k
            new(static_cast<void*>(dst)) T(*first);
170
1.31k
            ++dst;
171
1.31k
            ++first;
172
1.31k
        }
173
41
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
58.9k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
294k
        while (first != last) {
169
235k
            new(static_cast<void*>(dst)) T(*first);
170
235k
            ++dst;
171
235k
            ++first;
172
235k
        }
173
58.9k
    }
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
173
    void fill(T* dst, InputIterator first, InputIterator last) {
168
5.70k
        while (first != last) {
169
5.53k
            new(static_cast<void*>(dst)) T(*first);
170
5.53k
            ++dst;
171
5.53k
            ++first;
172
5.53k
        }
173
173
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
173
    void fill(T* dst, InputIterator first, InputIterator last) {
168
519
        while (first != last) {
169
346
            new(static_cast<void*>(dst)) T(*first);
170
346
            ++dst;
171
346
            ++first;
172
346
        }
173
173
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
173
    void fill(T* dst, InputIterator first, InputIterator last) {
168
346
        while (first != last) {
169
173
            new(static_cast<void*>(dst)) T(*first);
170
173
            ++dst;
171
173
            ++first;
172
173
        }
173
173
    }
174
175
public:
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<36u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&)
Line
Count
Source
176
143k
    void assign(size_type n, const T& val) {
177
143k
        clear();
178
143k
        if (capacity() < n) {
179
94.4k
            change_capacity(n);
180
94.4k
        }
181
143k
        _size += n;
182
143k
        fill(item_ptr(0), n, val);
183
143k
    }
prevector<16u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&)
Line
Count
Source
176
6
    void assign(size_type n, const T& val) {
177
6
        clear();
178
6
        if (capacity() < n) {
179
0
            change_capacity(n);
180
0
        }
181
6
        _size += n;
182
6
        fill(item_ptr(0), n, val);
183
6
    }
prevector<8u, int, unsigned int, int>::assign(unsigned int, int const&)
Line
Count
Source
176
266
    void assign(size_type n, const T& val) {
177
266
        clear();
178
266
        if (capacity() < n) {
179
114
            change_capacity(n);
180
114
        }
181
266
        _size += n;
182
266
        fill(item_ptr(0), n, val);
183
266
    }
184
185
    template <std::input_iterator InputIterator>
186
2.11M
    void assign(InputIterator first, InputIterator last) {
187
2.11M
        size_type n = last - first;
188
2.11M
        clear();
189
2.11M
        if (capacity() < n) {
190
120k
            change_capacity(n);
191
120k
        }
192
2.11M
        _size += n;
193
2.11M
        fill(item_ptr(0), first, last);
194
2.11M
    }
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
32.8k
    void assign(InputIterator first, InputIterator last) {
187
32.8k
        size_type n = last - first;
188
32.8k
        clear();
189
32.8k
        if (capacity() < n) {
190
35
            change_capacity(n);
191
35
        }
192
32.8k
        _size += n;
193
32.8k
        fill(item_ptr(0), first, last);
194
32.8k
    }
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.00M
    void assign(InputIterator first, InputIterator last) {
187
2.00M
        size_type n = last - first;
188
2.00M
        clear();
189
2.00M
        if (capacity() < n) {
190
119k
            change_capacity(n);
191
119k
        }
192
2.00M
        _size += n;
193
2.00M
        fill(item_ptr(0), first, last);
194
2.00M
    }
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.29k
    void assign(InputIterator first, InputIterator last) {
187
8.29k
        size_type n = last - first;
188
8.29k
        clear();
189
8.29k
        if (capacity() < n) {
190
604
            change_capacity(n);
191
604
        }
192
8.29k
        _size += n;
193
8.29k
        fill(item_ptr(0), first, last);
194
8.29k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
186
10.0k
    void assign(InputIterator first, InputIterator last) {
187
10.0k
        size_type n = last - first;
188
10.0k
        clear();
189
10.0k
        if (capacity() < n) {
190
63
            change_capacity(n);
191
63
        }
192
10.0k
        _size += n;
193
10.0k
        fill(item_ptr(0), first, last);
194
10.0k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char*>(unsigned char*, unsigned char*)
Line
Count
Source
186
10
    void assign(InputIterator first, InputIterator last) {
187
10
        size_type n = last - first;
188
10
        clear();
189
10
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
10
        _size += n;
193
10
        fill(item_ptr(0), first, last);
194
10
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
186
41
    void assign(InputIterator first, InputIterator last) {
187
41
        size_type n = last - first;
188
41
        clear();
189
41
        if (capacity() < n) {
190
40
            change_capacity(n);
191
40
        }
192
41
        _size += n;
193
41
        fill(item_ptr(0), first, last);
194
41
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char const*>(unsigned char const*, unsigned char const*)
Line
Count
Source
186
58.9k
    void assign(InputIterator first, InputIterator last) {
187
58.9k
        size_type n = last - first;
188
58.9k
        clear();
189
58.9k
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
58.9k
        _size += n;
193
58.9k
        fill(item_ptr(0), first, last);
194
58.9k
    }
195
196
88.8M
    prevector() = default;
prevector<36u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
88.3M
    prevector() = default;
prevector<33u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
495k
    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
293
    prevector() = default;
197
198
    explicit prevector(size_type n) {
199
        resize(n);
200
    }
201
202
446k
    explicit prevector(size_type n, const T& val) {
203
446k
        change_capacity(n);
204
446k
        _size += n;
205
446k
        fill(item_ptr(0), n, val);
206
446k
    }
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
328k
    explicit prevector(size_type n, const T& val) {
203
328k
        change_capacity(n);
204
328k
        _size += n;
205
328k
        fill(item_ptr(0), n, val);
206
328k
    }
207
208
    template <std::input_iterator InputIterator>
209
1.16M
    prevector(InputIterator first, InputIterator last) {
210
1.16M
        size_type n = last - first;
211
1.16M
        change_capacity(n);
212
1.16M
        _size += n;
213
1.16M
        fill(item_ptr(0), first, last);
214
1.16M
    }
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.0k
    prevector(InputIterator first, InputIterator last) {
210
38.0k
        size_type n = last - first;
211
38.0k
        change_capacity(n);
212
38.0k
        _size += n;
213
38.0k
        fill(item_ptr(0), first, last);
214
38.0k
    }
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
7.97k
    prevector(InputIterator first, InputIterator last) {
210
7.97k
        size_type n = last - first;
211
7.97k
        change_capacity(n);
212
7.97k
        _size += n;
213
7.97k
        fill(item_ptr(0), first, last);
214
7.97k
    }
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
214k
    prevector(InputIterator first, InputIterator last) {
210
214k
        size_type n = last - first;
211
214k
        change_capacity(n);
212
214k
        _size += n;
213
214k
        fill(item_ptr(0), first, last);
214
214k
    }
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
372k
    prevector(InputIterator first, InputIterator last) {
210
372k
        size_type n = last - first;
211
372k
        change_capacity(n);
212
372k
        _size += n;
213
372k
        fill(item_ptr(0), first, last);
214
372k
    }
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
173
    prevector(InputIterator first, InputIterator last) {
210
173
        size_type n = last - first;
211
173
        change_capacity(n);
212
173
        _size += n;
213
173
        fill(item_ptr(0), first, last);
214
173
    }
215
216
50.3M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
50.3M
        size_type n = other.size();
218
50.3M
        change_capacity(n);
219
50.3M
        _size += n;
220
50.3M
        fill(item_ptr(0), other.begin(),  other.end());
221
50.3M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
1.32M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
1.32M
        size_type n = other.size();
218
1.32M
        change_capacity(n);
219
1.32M
        _size += n;
220
1.32M
        fill(item_ptr(0), other.begin(),  other.end());
221
1.32M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
48.9M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
48.9M
        size_type n = other.size();
218
48.9M
        change_capacity(n);
219
48.9M
        _size += n;
220
48.9M
        fill(item_ptr(0), other.begin(),  other.end());
221
48.9M
    }
222
223
    prevector(prevector<N, T, Size, Diff>&& other) noexcept
224
16.4M
        : _union(std::move(other._union)), _size(other._size)
225
16.4M
    {
226
16.4M
        other._size = 0;
227
16.4M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
29.2k
        : _union(std::move(other._union)), _size(other._size)
225
29.2k
    {
226
29.2k
        other._size = 0;
227
29.2k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
16.3M
        : _union(std::move(other._union)), _size(other._size)
225
16.3M
    {
226
16.3M
        other._size = 0;
227
16.3M
    }
228
229
2.05M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
2.05M
        if (&other == this) {
231
12.9k
            return *this;
232
12.9k
        }
233
2.04M
        assign(other.begin(), other.end());
234
2.04M
        return *this;
235
2.05M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
32.8k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
32.8k
        if (&other == this) {
231
2
            return *this;
232
2
        }
233
32.8k
        assign(other.begin(), other.end());
234
32.8k
        return *this;
235
32.8k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
2.01M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
2.01M
        if (&other == this) {
231
12.9k
            return *this;
232
12.9k
        }
233
2.00M
        assign(other.begin(), other.end());
234
2.00M
        return *this;
235
2.01M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int> const&)
Line
Count
Source
229
8.29k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
8.29k
        if (&other == this) {
231
0
            return *this;
232
0
        }
233
8.29k
        assign(other.begin(), other.end());
234
8.29k
        return *this;
235
8.29k
    }
236
237
34.7M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
34.7M
        if (!is_direct()) {
239
23.6k
            free(_union.indirect_contents.indirect);
240
23.6k
        }
241
34.7M
        _union = std::move(other._union);
242
34.7M
        _size = other._size;
243
34.7M
        other._size = 0;
244
34.7M
        return *this;
245
34.7M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
91.5k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
91.5k
        if (!is_direct()) {
239
8
            free(_union.indirect_contents.indirect);
240
8
        }
241
91.5k
        _union = std::move(other._union);
242
91.5k
        _size = other._size;
243
91.5k
        other._size = 0;
244
91.5k
        return *this;
245
91.5k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
34.6M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
34.6M
        if (!is_direct()) {
239
21.1k
            free(_union.indirect_contents.indirect);
240
21.1k
        }
241
34.6M
        _union = std::move(other._union);
242
34.6M
        _size = other._size;
243
34.6M
        other._size = 0;
244
34.6M
        return *this;
245
34.6M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int>&&)
Line
Count
Source
237
4.11k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
4.11k
        if (!is_direct()) {
239
2.50k
            free(_union.indirect_contents.indirect);
240
2.50k
        }
241
4.11k
        _union = std::move(other._union);
242
4.11k
        _size = other._size;
243
4.11k
        other._size = 0;
244
4.11k
        return *this;
245
4.11k
    }
246
247
2.00G
    size_type size() const {
248
2.00G
        return is_direct() ? _size : _size - N - 1;
249
2.00G
    }
prevector<36u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.98G
    size_type size() const {
248
1.98G
        return is_direct() ? _size : _size - N - 1;
249
1.98G
    }
prevector<16u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
11.0M
    size_type size() const {
248
11.0M
        return is_direct() ? _size : _size - N - 1;
249
11.0M
    }
prevector<33u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
375k
    size_type size() const {
248
375k
        return is_direct() ? _size : _size - N - 1;
249
375k
    }
prevector<8u, int, unsigned int, int>::size() const
Line
Count
Source
247
7.04M
    size_type size() const {
248
7.04M
        return is_direct() ? _size : _size - N - 1;
249
7.04M
    }
prevector<4u, Network, unsigned int, int>::size() const
Line
Count
Source
247
1.63k
    size_type size() const {
248
1.63k
        return is_direct() ? _size : _size - N - 1;
249
1.63k
    }
prevector<35u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.21k
    size_type size() const {
248
1.21k
        return is_direct() ? _size : _size - N - 1;
249
1.21k
    }
250
251
31.2M
    bool empty() const {
252
31.2M
        return size() == 0;
253
31.2M
    }
prevector<36u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
30.9M
    bool empty() const {
252
30.9M
        return size() == 0;
253
30.9M
    }
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
293
    bool empty() const {
252
293
        return size() == 0;
253
293
    }
254
255
20.2M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
15.1M
    iterator begin() { return iterator(item_ptr(0)); }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::begin()
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::begin()
prevector<8u, int, unsigned int, int>::begin()
Line
Count
Source
255
5.03M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<35u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
346
    iterator begin() { return iterator(item_ptr(0)); }
256
141M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
133M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<16u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
5.88M
    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
42.3M
    iterator end() { return iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
39.0M
    iterator end() { return iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
287k
    iterator end() { return iterator(item_ptr(size())); }
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::end()
prevector<8u, int, unsigned int, int>::end()
Line
Count
Source
257
2.92M
    iterator end() { return iterator(item_ptr(size())); }
prevector<35u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
346
    iterator end() { return iterator(item_ptr(size())); }
258
1.45G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.44G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.83M
    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
18.4M
    size_t capacity() const {
261
18.4M
        if (is_direct()) {
262
12.6M
            return N;
263
12.6M
        } else {
264
5.87M
            return _union.indirect_contents.capacity;
265
5.87M
        }
266
18.4M
    }
prevector<36u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
18.1M
    size_t capacity() const {
261
18.1M
        if (is_direct()) {
262
12.3M
            return N;
263
12.3M
        } else {
264
5.81M
            return _union.indirect_contents.capacity;
265
5.81M
        }
266
18.1M
    }
prevector<16u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
102k
    size_t capacity() const {
261
102k
        if (is_direct()) {
262
102k
            return N;
263
102k
        } else {
264
10
            return _union.indirect_contents.capacity;
265
10
        }
266
102k
    }
prevector<8u, int, unsigned int, int>::capacity() const
Line
Count
Source
260
92.7k
    size_t capacity() const {
261
92.7k
        if (is_direct()) {
262
34.5k
            return N;
263
58.1k
        } else {
264
58.1k
            return _union.indirect_contents.capacity;
265
58.1k
        }
266
92.7k
    }
prevector<4u, Network, unsigned int, int>::capacity() const
Line
Count
Source
260
526
    size_t capacity() const {
261
526
        if (is_direct()) {
262
526
            return N;
263
526
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
526
    }
prevector<33u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
128k
    size_t capacity() const {
261
128k
        if (is_direct()) {
262
128k
            return N;
263
128k
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
128k
    }
prevector<35u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
346
    size_t capacity() const {
261
346
        if (is_direct()) {
262
346
            return N;
263
346
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
346
    }
267
268
10.6M
    T& operator[](size_type pos) {
269
10.6M
        return *item_ptr(pos);
270
10.6M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
2.10M
    T& operator[](size_type pos) {
269
2.10M
        return *item_ptr(pos);
270
2.10M
    }
prevector<33u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
257k
    T& operator[](size_type pos) {
269
257k
        return *item_ptr(pos);
270
257k
    }
prevector<8u, int, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
8.26M
    T& operator[](size_type pos) {
269
8.26M
        return *item_ptr(pos);
270
8.26M
    }
prevector<4u, Network, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
293
    T& operator[](size_type pos) {
269
293
        return *item_ptr(pos);
270
293
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
5.11k
    T& operator[](size_type pos) {
269
5.11k
        return *item_ptr(pos);
270
5.11k
    }
271
272
19.8M
    const T& operator[](size_type pos) const {
273
19.8M
        return *item_ptr(pos);
274
19.8M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
11.2M
    const T& operator[](size_type pos) const {
273
11.2M
        return *item_ptr(pos);
274
11.2M
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
8.59M
    const T& operator[](size_type pos) const {
273
8.59M
        return *item_ptr(pos);
274
8.59M
    }
275
276
88.5M
    void resize(size_type new_size) {
277
88.5M
        size_type cur_size = size();
278
88.5M
        if (cur_size == new_size) {
279
75.7M
            return;
280
75.7M
        }
281
12.8M
        if (cur_size > new_size) {
282
12.2M
            erase(item_ptr(new_size), end());
283
12.2M
            return;
284
12.2M
        }
285
577k
        if (new_size > capacity()) {
286
86.0k
            change_capacity(new_size);
287
86.0k
        }
288
577k
        ptrdiff_t increase = new_size - cur_size;
289
577k
        fill(item_ptr(cur_size), increase);
290
577k
        _size += increase;
291
577k
    }
prevector<36u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
88.2M
    void resize(size_type new_size) {
277
88.2M
        size_type cur_size = size();
278
88.2M
        if (cur_size == new_size) {
279
75.7M
            return;
280
75.7M
        }
281
12.5M
        if (cur_size > new_size) {
282
12.0M
            erase(item_ptr(new_size), end());
283
12.0M
            return;
284
12.0M
        }
285
441k
        if (new_size > capacity()) {
286
85.4k
            change_capacity(new_size);
287
85.4k
        }
288
441k
        ptrdiff_t increase = new_size - cur_size;
289
441k
        fill(item_ptr(cur_size), increase);
290
441k
        _size += increase;
291
441k
    }
prevector<16u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
143k
    void resize(size_type new_size) {
277
143k
        size_type cur_size = size();
278
143k
        if (cur_size == new_size) {
279
101
            return;
280
101
        }
281
143k
        if (cur_size > new_size) {
282
143k
            erase(item_ptr(new_size), end());
283
143k
            return;
284
143k
        }
285
284
        if (new_size > capacity()) {
286
282
            change_capacity(new_size);
287
282
        }
288
284
        ptrdiff_t increase = new_size - cur_size;
289
284
        fill(item_ptr(cur_size), increase);
290
284
        _size += increase;
291
284
    }
prevector<8u, int, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
29.1k
    void resize(size_type new_size) {
277
29.1k
        size_type cur_size = size();
278
29.1k
        if (cur_size == new_size) {
279
10.3k
            return;
280
10.3k
        }
281
18.7k
        if (cur_size > new_size) {
282
12.3k
            erase(item_ptr(new_size), end());
283
12.3k
            return;
284
12.3k
        }
285
6.40k
        if (new_size > capacity()) {
286
322
            change_capacity(new_size);
287
322
        }
288
6.40k
        ptrdiff_t increase = new_size - cur_size;
289
6.40k
        fill(item_ptr(cur_size), increase);
290
6.40k
        _size += increase;
291
6.40k
    }
prevector<33u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
128k
    void resize(size_type new_size) {
277
128k
        size_type cur_size = size();
278
128k
        if (cur_size == new_size) {
279
0
            return;
280
0
        }
281
128k
        if (cur_size > new_size) {
282
0
            erase(item_ptr(new_size), end());
283
0
            return;
284
0
        }
285
128k
        if (new_size > capacity()) {
286
0
            change_capacity(new_size);
287
0
        }
288
128k
        ptrdiff_t increase = new_size - cur_size;
289
128k
        fill(item_ptr(cur_size), increase);
290
128k
        _size += increase;
291
128k
    }
292
293
4.08k
    void reserve(size_type new_capacity) {
294
4.08k
        if (new_capacity > capacity()) {
295
1.85k
            change_capacity(new_capacity);
296
1.85k
        }
297
4.08k
    }
298
299
84.3M
    void shrink_to_fit() {
300
84.3M
        change_capacity(size());
301
84.3M
    }
prevector<36u, unsigned char, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
84.3M
    void shrink_to_fit() {
300
84.3M
        change_capacity(size());
301
84.3M
    }
prevector<8u, int, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
2.03k
    void shrink_to_fit() {
300
2.03k
        change_capacity(size());
301
2.03k
    }
302
303
87.9M
    void clear() {
304
87.9M
        resize(0);
305
87.9M
    }
prevector<36u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
87.7M
    void clear() {
304
87.7M
        resize(0);
305
87.7M
    }
prevector<16u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
101k
    void clear() {
304
101k
        resize(0);
305
101k
    }
prevector<8u, int, unsigned int, int>::clear()
Line
Count
Source
303
12.8k
    void clear() {
304
12.8k
        resize(0);
305
12.8k
    }
306
307
9.03M
    iterator insert(iterator pos, const T& value) {
308
9.03M
        size_type p = pos - begin();
309
9.03M
        size_type new_size = size() + 1;
310
9.03M
        if (capacity() < new_size) {
311
8.08k
            change_capacity(new_size + (new_size >> 1));
312
8.08k
        }
313
9.03M
        T* ptr = item_ptr(p);
314
9.03M
        T* dst = ptr + 1;
315
9.03M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.03M
        _size++;
317
9.03M
        new(static_cast<void*>(ptr)) T(value);
318
9.03M
        return iterator(ptr);
319
9.03M
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const&)
Line
Count
Source
307
9.00M
    iterator insert(iterator pos, const T& value) {
308
9.00M
        size_type p = pos - begin();
309
9.00M
        size_type new_size = size() + 1;
310
9.00M
        if (capacity() < new_size) {
311
6.66k
            change_capacity(new_size + (new_size >> 1));
312
6.66k
        }
313
9.00M
        T* ptr = item_ptr(p);
314
9.00M
        T* dst = ptr + 1;
315
9.00M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.00M
        _size++;
317
9.00M
        new(static_cast<void*>(ptr)) T(value);
318
9.00M
        return iterator(ptr);
319
9.00M
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, int const&)
Line
Count
Source
307
32.7k
    iterator insert(iterator pos, const T& value) {
308
32.7k
        size_type p = pos - begin();
309
32.7k
        size_type new_size = size() + 1;
310
32.7k
        if (capacity() < new_size) {
311
1.42k
            change_capacity(new_size + (new_size >> 1));
312
1.42k
        }
313
32.7k
        T* ptr = item_ptr(p);
314
32.7k
        T* dst = ptr + 1;
315
32.7k
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
32.7k
        _size++;
317
32.7k
        new(static_cast<void*>(ptr)) T(value);
318
32.7k
        return iterator(ptr);
319
32.7k
    }
320
321
16.5k
    void insert(iterator pos, size_type count, const T& value) {
322
16.5k
        size_type p = pos - begin();
323
16.5k
        size_type new_size = size() + count;
324
16.5k
        if (capacity() < new_size) {
325
747
            change_capacity(new_size + (new_size >> 1));
326
747
        }
327
16.5k
        T* ptr = item_ptr(p);
328
16.5k
        T* dst = ptr + count;
329
16.5k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.5k
        _size += count;
331
16.5k
        fill(item_ptr(p), count, value);
332
16.5k
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, unsigned int, int const&)
Line
Count
Source
321
16.5k
    void insert(iterator pos, size_type count, const T& value) {
322
16.5k
        size_type p = pos - begin();
323
16.5k
        size_type new_size = size() + count;
324
16.5k
        if (capacity() < new_size) {
325
740
            change_capacity(new_size + (new_size >> 1));
326
740
        }
327
16.5k
        T* ptr = item_ptr(p);
328
16.5k
        T* dst = ptr + count;
329
16.5k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.5k
        _size += count;
331
16.5k
        fill(item_ptr(p), count, value);
332
16.5k
    }
prevector<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.48M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
5.48M
        size_type p = pos - begin();
337
5.48M
        difference_type count = last - first;
338
5.48M
        size_type new_size = size() + count;
339
5.48M
        if (capacity() < new_size) {
340
369k
            change_capacity(new_size + (new_size >> 1));
341
369k
        }
342
5.48M
        T* ptr = item_ptr(p);
343
5.48M
        T* dst = ptr + count;
344
5.48M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
5.48M
        _size += count;
346
5.48M
        fill(ptr, first, last);
347
5.48M
    }
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.71M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.71M
        size_type p = pos - begin();
337
2.71M
        difference_type count = last - first;
338
2.71M
        size_type new_size = size() + count;
339
2.71M
        if (capacity() < new_size) {
340
223k
            change_capacity(new_size + (new_size >> 1));
341
223k
        }
342
2.71M
        T* ptr = item_ptr(p);
343
2.71M
        T* dst = ptr + count;
344
2.71M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.71M
        _size += count;
346
2.71M
        fill(ptr, first, last);
347
2.71M
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
335
22.8k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
22.8k
        size_type p = pos - begin();
337
22.8k
        difference_type count = last - first;
338
22.8k
        size_type new_size = size() + count;
339
22.8k
        if (capacity() < new_size) {
340
17.1k
            change_capacity(new_size + (new_size >> 1));
341
17.1k
        }
342
22.8k
        T* ptr = item_ptr(p);
343
22.8k
        T* dst = ptr + count;
344
22.8k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
22.8k
        _size += count;
346
22.8k
        fill(ptr, first, last);
347
22.8k
    }
void prevector<8u, int, unsigned int, int>::insert<int*>(prevector<8u, int, unsigned int, int>::iterator, int*, int*)
Line
Count
Source
335
4.09k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
4.09k
        size_type p = pos - begin();
337
4.09k
        difference_type count = last - first;
338
4.09k
        size_type new_size = size() + count;
339
4.09k
        if (capacity() < new_size) {
340
306
            change_capacity(new_size + (new_size >> 1));
341
306
        }
342
4.09k
        T* ptr = item_ptr(p);
343
4.09k
        T* dst = ptr + count;
344
4.09k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
4.09k
        _size += count;
346
4.09k
        fill(ptr, first, last);
347
4.09k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(prevector<36u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
335
2.74k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.74k
        size_type p = pos - begin();
337
2.74k
        difference_type count = last - first;
338
2.74k
        size_type new_size = size() + count;
339
2.74k
        if (capacity() < new_size) {
340
238
            change_capacity(new_size + (new_size >> 1));
341
238
        }
342
2.74k
        T* ptr = item_ptr(p);
343
2.74k
        T* dst = ptr + count;
344
2.74k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.74k
        _size += count;
346
2.74k
        fill(ptr, first, last);
347
2.74k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
335
2.74M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.74M
        size_type p = pos - begin();
337
2.74M
        difference_type count = last - first;
338
2.74M
        size_type new_size = size() + count;
339
2.74M
        if (capacity() < new_size) {
340
127k
            change_capacity(new_size + (new_size >> 1));
341
127k
        }
342
2.74M
        T* ptr = item_ptr(p);
343
2.74M
        T* dst = ptr + count;
344
2.74M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.74M
        _size += count;
346
2.74M
        fill(ptr, first, last);
347
2.74M
    }
void prevector<35u, unsigned char, unsigned int, int>::insert<unsigned char*>(prevector<35u, unsigned char, unsigned int, int>::iterator, unsigned char*, unsigned char*)
Line
Count
Source
335
173
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
173
        size_type p = pos - begin();
337
173
        difference_type count = last - first;
338
173
        size_type new_size = size() + count;
339
173
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
173
        T* ptr = item_ptr(p);
343
173
        T* dst = ptr + count;
344
173
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
173
        _size += count;
346
173
        fill(ptr, first, last);
347
173
    }
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
173
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
173
        size_type p = pos - begin();
337
173
        difference_type count = last - first;
338
173
        size_type new_size = size() + count;
339
173
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
173
        T* ptr = item_ptr(p);
343
173
        T* dst = ptr + count;
344
173
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
173
        _size += count;
346
173
        fill(ptr, first, last);
347
173
    }
348
349
1.03M
    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.03M
        if (capacity() < new_size) {
353
222k
            change_capacity(new_size);
354
222k
            _size += new_size - size();
355
222k
            return;
356
222k
        }
357
813k
        if (new_size < size()) {
358
3.18k
            erase(item_ptr(new_size), end());
359
810k
        } else {
360
810k
            _size += new_size - size();
361
810k
        }
362
813k
    }
prevector<36u, unsigned char, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
1.02M
    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.02M
        if (capacity() < new_size) {
353
221k
            change_capacity(new_size);
354
221k
            _size += new_size - size();
355
221k
            return;
356
221k
        }
357
806k
        if (new_size < size()) {
358
0
            erase(item_ptr(new_size), end());
359
806k
        } else {
360
806k
            _size += new_size - size();
361
806k
        }
362
806k
    }
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.18k
            change_capacity(new_size);
354
1.18k
            _size += new_size - size();
355
1.18k
            return;
356
1.18k
        }
357
6.90k
        if (new_size < size()) {
358
3.18k
            erase(item_ptr(new_size), end());
359
3.72k
        } else {
360
3.72k
            _size += new_size - size();
361
3.72k
        }
362
6.90k
    }
363
364
27.5k
    iterator erase(iterator pos) {
365
27.5k
        return erase(pos, pos + 1);
366
27.5k
    }
367
368
12.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
12.2M
        iterator p = first;
376
12.2M
        char* endp = (char*)&(*end());
377
12.2M
        _size -= last - p;
378
12.2M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
12.2M
        return first;
380
12.2M
    }
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
12.0M
    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
12.0M
        iterator p = first;
376
12.0M
        char* endp = (char*)&(*end());
377
12.0M
        _size -= last - p;
378
12.0M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
12.0M
        return first;
380
12.0M
    }
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
143k
    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
143k
        iterator p = first;
376
143k
        char* endp = (char*)&(*end());
377
143k
        _size -= last - p;
378
143k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
143k
        return first;
380
143k
    }
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
69.9k
    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
69.9k
        iterator p = first;
376
69.9k
        char* endp = (char*)&(*end());
377
69.9k
        _size -= last - p;
378
69.9k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
69.9k
        return first;
380
69.9k
    }
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::erase(prevector<33u, unsigned char, unsigned int, int>::iterator, prevector<33u, unsigned char, unsigned int, int>::iterator)
381
382
    template<typename... Args>
383
81.6k
    void emplace_back(Args&&... args) {
384
81.6k
        size_type new_size = size() + 1;
385
81.6k
        if (capacity() < new_size) {
386
13.3k
            change_capacity(new_size + (new_size >> 1));
387
13.3k
        }
388
81.6k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
81.6k
        _size++;
390
81.6k
    }
void prevector<36u, unsigned char, unsigned int, int>::emplace_back<unsigned char const&>(unsigned char const&)
Line
Count
Source
383
72.9k
    void emplace_back(Args&&... args) {
384
72.9k
        size_type new_size = size() + 1;
385
72.9k
        if (capacity() < new_size) {
386
13.0k
            change_capacity(new_size + (new_size >> 1));
387
13.0k
        }
388
72.9k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
72.9k
        _size++;
390
72.9k
    }
void prevector<8u, int, unsigned int, int>::emplace_back<int const&>(int const&)
Line
Count
Source
383
8.16k
    void emplace_back(Args&&... args) {
384
8.16k
        size_type new_size = size() + 1;
385
8.16k
        if (capacity() < new_size) {
386
221
            change_capacity(new_size + (new_size >> 1));
387
221
        }
388
8.16k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
8.16k
        _size++;
390
8.16k
    }
void prevector<4u, Network, unsigned int, int>::emplace_back<Network const&>(Network const&)
Line
Count
Source
383
526
    void emplace_back(Args&&... args) {
384
526
        size_type new_size = size() + 1;
385
526
        if (capacity() < new_size) {
386
0
            change_capacity(new_size + (new_size >> 1));
387
0
        }
388
526
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
526
        _size++;
390
526
    }
391
392
81.6k
    void push_back(const T& value) {
393
81.6k
        emplace_back(value);
394
81.6k
    }
prevector<36u, unsigned char, unsigned int, int>::push_back(unsigned char const&)
Line
Count
Source
392
72.9k
    void push_back(const T& value) {
393
72.9k
        emplace_back(value);
394
72.9k
    }
prevector<8u, int, unsigned int, int>::push_back(int const&)
Line
Count
Source
392
8.16k
    void push_back(const T& value) {
393
8.16k
        emplace_back(value);
394
8.16k
    }
prevector<4u, Network, unsigned int, int>::push_back(Network const&)
Line
Count
Source
392
526
    void push_back(const T& value) {
393
526
        emplace_back(value);
394
526
    }
395
396
6.78k
    void pop_back() {
397
6.78k
        erase(end() - 1, end());
398
6.78k
    }
399
400
    T& front() {
401
        return *item_ptr(0);
402
    }
403
404
    const T& front() const {
405
        return *item_ptr(0);
406
    }
407
408
    T& back() {
409
        return *item_ptr(size() - 1);
410
    }
411
412
27.8k
    const T& back() const {
413
27.8k
        return *item_ptr(size() - 1);
414
27.8k
    }
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
157M
    ~prevector() {
423
157M
        if (!is_direct()) {
424
2.27M
            free(_union.indirect_contents.indirect);
425
2.27M
            _union.indirect_contents.indirect = nullptr;
426
2.27M
        }
427
157M
    }
prevector<16u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
1.66M
    ~prevector() {
423
1.66M
        if (!is_direct()) {
424
1.93k
            free(_union.indirect_contents.indirect);
425
1.93k
            _union.indirect_contents.indirect = nullptr;
426
1.93k
        }
427
1.66M
    }
prevector<36u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
154M
    ~prevector() {
423
154M
        if (!is_direct()) {
424
2.07M
            free(_union.indirect_contents.indirect);
425
2.07M
            _union.indirect_contents.indirect = nullptr;
426
2.07M
        }
427
154M
    }
prevector<33u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
613k
    ~prevector() {
423
613k
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
613k
    }
prevector<8u, int, unsigned int, int>::~prevector()
Line
Count
Source
422
532k
    ~prevector() {
423
532k
        if (!is_direct()) {
424
195k
            free(_union.indirect_contents.indirect);
425
195k
            _union.indirect_contents.indirect = nullptr;
426
195k
        }
427
532k
    }
prevector<4u, Network, unsigned int, int>::~prevector()
Line
Count
Source
422
293
    ~prevector() {
423
293
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
293
    }
prevector<35u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
173
    ~prevector() {
423
173
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
173
    }
428
429
6.44M
    constexpr bool operator==(const prevector& other) const {
430
6.44M
        return std::ranges::equal(*this, other);
431
6.44M
    }
prevector<36u, unsigned char, unsigned int, int>::operator==(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
5.69M
    constexpr bool operator==(const prevector& other) const {
430
5.69M
        return std::ranges::equal(*this, other);
431
5.69M
    }
prevector<8u, int, unsigned int, int>::operator==(prevector<8u, int, unsigned int, int> const&) const
Line
Count
Source
429
532k
    constexpr bool operator==(const prevector& other) const {
430
532k
        return std::ranges::equal(*this, other);
431
532k
    }
prevector<16u, unsigned char, unsigned int, int>::operator==(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
218k
    constexpr bool operator==(const prevector& other) const {
430
218k
        return std::ranges::equal(*this, other);
431
218k
    }
432
433
21.4M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.4M
        if (size() < other.size()) {
435
925k
            return true;
436
925k
        }
437
20.4M
        if (size() > other.size()) {
438
301k
            return false;
439
301k
        }
440
20.1M
        const_iterator b1 = begin();
441
20.1M
        const_iterator b2 = other.begin();
442
20.1M
        const_iterator e1 = end();
443
126M
        while (b1 != e1) {
444
124M
            if ((*b1) < (*b2)) {
445
10.0M
                return true;
446
10.0M
            }
447
114M
            if ((*b2) < (*b1)) {
448
7.71M
                return false;
449
7.71M
            }
450
106M
            ++b1;
451
106M
            ++b2;
452
106M
        }
453
2.46M
        return false;
454
20.1M
    }
prevector<36u, unsigned char, unsigned int, int>::operator<(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
21.3M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.3M
        if (size() < other.size()) {
435
925k
            return true;
436
925k
        }
437
20.4M
        if (size() > other.size()) {
438
301k
            return false;
439
301k
        }
440
20.1M
        const_iterator b1 = begin();
441
20.1M
        const_iterator b2 = other.begin();
442
20.1M
        const_iterator e1 = end();
443
126M
        while (b1 != e1) {
444
124M
            if ((*b1) < (*b2)) {
445
9.99M
                return true;
446
9.99M
            }
447
114M
            if ((*b2) < (*b1)) {
448
7.71M
                return false;
449
7.71M
            }
450
106M
            ++b1;
451
106M
            ++b2;
452
106M
        }
453
2.43M
        return false;
454
20.1M
    }
prevector<16u, unsigned char, unsigned int, int>::operator<(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
28.0k
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
28.0k
        if (size() < other.size()) {
435
0
            return true;
436
0
        }
437
28.0k
        if (size() > other.size()) {
438
0
            return false;
439
0
        }
440
28.0k
        const_iterator b1 = begin();
441
28.0k
        const_iterator b2 = other.begin();
442
28.0k
        const_iterator e1 = end();
443
139k
        while (b1 != e1) {
444
112k
            if ((*b1) < (*b2)) {
445
615
                return true;
446
615
            }
447
111k
            if ((*b2) < (*b1)) {
448
222
                return false;
449
222
            }
450
111k
            ++b1;
451
111k
            ++b2;
452
111k
        }
453
27.2k
        return false;
454
28.0k
    }
455
456
46.1M
    size_t allocated_memory() const {
457
46.1M
        if (is_direct()) {
458
45.2M
            return 0;
459
45.2M
        } else {
460
880k
            return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity;
461
880k
        }
462
46.1M
    }
463
464
600k
    value_type* data() {
465
600k
        return item_ptr(0);
466
600k
    }
prevector<16u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
42.0k
    value_type* data() {
465
42.0k
        return item_ptr(0);
466
42.0k
    }
prevector<33u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
246k
    value_type* data() {
465
246k
        return item_ptr(0);
466
246k
    }
prevector<36u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
311k
    value_type* data() {
465
311k
        return item_ptr(0);
466
311k
    }
prevector<35u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
173
    value_type* data() {
465
173
        return item_ptr(0);
466
173
    }
467
468
31.3M
    const value_type* data() const {
469
31.3M
        return item_ptr(0);
470
31.3M
    }
prevector<36u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
28.6M
    const value_type* data() const {
469
28.6M
        return item_ptr(0);
470
28.6M
    }
prevector<16u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
2.57M
    const value_type* data() const {
469
2.57M
        return item_ptr(0);
470
2.57M
    }
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