Coverage Report

Created: 2026-07-29 23:27

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
85.9M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
71.2M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
444k
        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
724
        iterator(T* ptr_) : ptr(ptr_) {}
61
143M
        T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
131M
        T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
888k
        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
724
        T& operator*() const { return *ptr; }
62
35.2k
        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.2k
        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.8M
        iterator& operator++() { ptr++; return *this; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator++()
Line
Count
Source
64
37.7M
        iterator& operator++() { ptr++; return *this; }
prevector<8u, int, unsigned int, int>::iterator::operator++()
Line
Count
Source
64
4.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
25.8M
        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
25.3M
        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
148k
        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
362
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
69
4.21M
        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.8M
        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.89M
        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.55G
        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.75M
        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.54G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::const_iterator::const_iterator(int const*)
Line
Count
Source
87
3.73M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
88
740k
        const_iterator(iterator x) : ptr(&(*x)) {}
89
17.8G
        const T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
17.8G
        const T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
12.5M
        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.86M
        const T* operator->() const { return ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
3.86M
        const T* operator->() const { return ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
483
        const T* operator->() const { return ptr; }
91
179k
        const T& operator[](size_type pos) const { return ptr[pos]; }
92
16.0G
        const_iterator& operator++() { ptr++; return *this; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
16.0G
        const_iterator& operator++() { ptr++; return *this; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
7.12M
        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
671M
        const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
95
        const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
96
721M
        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
719M
        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
476k
        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.00M
        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.48M
        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.3G
        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.11M
        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.34G
        auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<16u, unsigned char, unsigned int, int>::const_iterator) const
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<36u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
103
1.34G
        auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; }
Unexecuted instantiation: prevector<8u, int, unsigned int, int>::const_iterator::operator<=>(prevector<8u, int, unsigned int, int>::const_iterator) const
104
    };
105
106
private:
107
#pragma pack(push, 1)
108
    union direct_or_indirect {
109
        char direct[sizeof(T) * N];
110
        struct {
111
            char* indirect;
112
            size_type capacity;
113
        } indirect_contents;
114
    };
115
#pragma pack(pop)
116
    alignas(char*) direct_or_indirect _union = {};
117
    size_type _size = 0;
118
119
    static_assert(alignof(char*) % alignof(size_type) == 0 && sizeof(char*) % alignof(size_type) == 0, "size_type cannot have more restrictive alignment requirement than pointer");
120
    static_assert(alignof(char*) % alignof(T) == 0, "value_type T cannot have more restrictive alignment requirement than pointer");
121
122
115M
    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
109M
    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.27M
    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
768k
    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.90M
    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
915
    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.44k
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
123
280M
    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
259M
    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.9M
    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.5M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
2.33k
    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.32G
    const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }
prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int) const
Line
Count
Source
125
1.32G
    const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int) const
Line
Count
Source
125
5.74k
    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.04G
    bool is_direct() const { return _size <= N; }
prevector<36u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.97G
    bool is_direct() const { return _size <= N; }
prevector<16u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
35.9M
    bool is_direct() const { return _size <= N; }
prevector<33u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
2.14M
    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.66k
    bool is_direct() const { return _size <= N; }
prevector<35u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
3.43k
    bool is_direct() const { return _size <= N; }
127
128
122M
    void change_capacity(size_type new_capacity) {
129
122M
        if (new_capacity <= N) {
130
120M
            if (!is_direct()) {
131
44.8k
                T* indirect = indirect_ptr(0);
132
44.8k
                T* src = indirect;
133
44.8k
                T* dst = direct_ptr(0);
134
44.8k
                memcpy(dst, src, size() * sizeof(T));
135
44.8k
                free(indirect);
136
44.8k
                _size -= N + 1;
137
44.8k
            }
138
120M
        } else {
139
2.44M
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
82.9k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
82.9k
                assert(_union.indirect_contents.indirect);
145
82.9k
                _union.indirect_contents.capacity = new_capacity;
146
2.36M
            } else {
147
2.36M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.36M
                assert(new_indirect);
149
2.36M
                T* src = direct_ptr(0);
150
2.36M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.36M
                memcpy(dst, src, size() * sizeof(T));
152
2.36M
                _union.indirect_contents.indirect = new_indirect;
153
2.36M
                _union.indirect_contents.capacity = new_capacity;
154
2.36M
                _size += N + 1;
155
2.36M
            }
156
2.44M
        }
157
122M
    }
prevector<36u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
120M
    void change_capacity(size_type new_capacity) {
129
120M
        if (new_capacity <= N) {
130
118M
            if (!is_direct()) {
131
44.2k
                T* indirect = indirect_ptr(0);
132
44.2k
                T* src = indirect;
133
44.2k
                T* dst = direct_ptr(0);
134
44.2k
                memcpy(dst, src, size() * sizeof(T));
135
44.2k
                free(indirect);
136
44.2k
                _size -= N + 1;
137
44.2k
            }
138
118M
        } else {
139
2.24M
            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.9k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
78.9k
                assert(_union.indirect_contents.indirect);
145
78.9k
                _union.indirect_contents.capacity = new_capacity;
146
2.16M
            } else {
147
2.16M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.16M
                assert(new_indirect);
149
2.16M
                T* src = direct_ptr(0);
150
2.16M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.16M
                memcpy(dst, src, size() * sizeof(T));
152
2.16M
                _union.indirect_contents.indirect = new_indirect;
153
2.16M
                _union.indirect_contents.capacity = new_capacity;
154
2.16M
                _size += N + 1;
155
2.16M
            }
156
2.24M
        }
157
120M
    }
prevector<16u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
1.67M
    void change_capacity(size_type new_capacity) {
129
1.67M
        if (new_capacity <= N) {
130
1.67M
            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.67M
        } else {
139
2.00k
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
0
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
0
                assert(_union.indirect_contents.indirect);
145
0
                _union.indirect_contents.capacity = new_capacity;
146
2.00k
            } else {
147
2.00k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.00k
                assert(new_indirect);
149
2.00k
                T* src = direct_ptr(0);
150
2.00k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.00k
                memcpy(dst, src, size() * sizeof(T));
152
2.00k
                _union.indirect_contents.indirect = new_indirect;
153
2.00k
                _union.indirect_contents.capacity = new_capacity;
154
2.00k
                _size += N + 1;
155
2.00k
            }
156
2.00k
        }
157
1.67M
    }
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
339k
            if (!is_direct()) {
131
603
                T* indirect = indirect_ptr(0);
132
603
                T* src = indirect;
133
603
                T* dst = direct_ptr(0);
134
603
                memcpy(dst, src, size() * sizeof(T));
135
603
                free(indirect);
136
603
                _size -= N + 1;
137
603
            }
138
339k
        } else {
139
201k
            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.07k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
4.07k
                assert(_union.indirect_contents.indirect);
145
4.07k
                _union.indirect_contents.capacity = new_capacity;
146
197k
            } else {
147
197k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
197k
                assert(new_indirect);
149
197k
                T* src = direct_ptr(0);
150
197k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
197k
                memcpy(dst, src, size() * sizeof(T));
152
197k
                _union.indirect_contents.indirect = new_indirect;
153
197k
                _union.indirect_contents.capacity = new_capacity;
154
197k
                _size += N + 1;
155
197k
            }
156
201k
        }
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
181
    void change_capacity(size_type new_capacity) {
129
181
        if (new_capacity <= N) {
130
181
            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
181
        } 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
181
    }
158
159
147M
    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
127M
    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.27M
    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
768k
    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
915
    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.44k
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
160
1.60G
    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.58G
    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
19.0M
    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.73M
    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
580k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
580k
        std::fill_n(dst, count, value);
164
580k
    }
prevector<16u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
333k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
333k
        std::fill_n(dst, count, value);
164
333k
    }
prevector<33u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
251k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
251k
        std::fill_n(dst, count, value);
164
251k
    }
prevector<8u, int, unsigned int, int>::fill(int*, long, int const&)
Line
Count
Source
162
23.3k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
23.3k
        std::fill_n(dst, count, value);
164
23.3k
    }
165
166
    template <std::input_iterator InputIterator>
167
55.6M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.3G
        while (first != last) {
169
15.2G
            new(static_cast<void*>(dst)) T(*first);
170
15.2G
            ++dst;
171
15.2G
            ++first;
172
15.2G
        }
173
55.6M
    }
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.72M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
83.4M
        while (first != last) {
169
80.6M
            new(static_cast<void*>(dst)) T(*first);
170
80.6M
            ++dst;
171
80.6M
            ++first;
172
80.6M
        }
173
2.72M
    }
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.37M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
7.20M
        while (first != last) {
169
5.83M
            new(static_cast<void*>(dst)) T(*first);
170
5.83M
            ++dst;
171
5.83M
            ++first;
172
5.83M
        }
173
1.37M
    }
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
50.6M
    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
50.6M
    }
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.64M
        while (first != last) {
169
1.60M
            new(static_cast<void*>(dst)) T(*first);
170
1.60M
            ++dst;
171
1.60M
            ++first;
172
1.60M
        }
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
265k
    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
265k
    }
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
265k
    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
265k
    }
void prevector<8u, int, unsigned int, int>::fill<int*>(int*, int*, int*)
Line
Count
Source
167
4.01k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
14.1k
        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.01k
    }
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.13k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
53.5k
        while (first != last) {
169
45.4k
            new(static_cast<void*>(dst)) T(*first);
170
45.4k
            ++dst;
171
45.4k
            ++first;
172
45.4k
        }
173
8.13k
    }
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
24.9M
        while (first != last) {
169
24.7M
            new(static_cast<void*>(dst)) T(*first);
170
24.7M
            ++dst;
171
24.7M
            ++first;
172
24.7M
        }
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.1k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
92.1k
        while (first != last) {
169
82.0k
            new(static_cast<void*>(dst)) T(*first);
170
82.0k
            ++dst;
171
82.0k
            ++first;
172
82.0k
        }
173
10.1k
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
10
    void fill(T* dst, InputIterator first, InputIterator last) {
168
110
        while (first != last) {
169
100
            new(static_cast<void*>(dst)) T(*first);
170
100
            ++dst;
171
100
            ++first;
172
100
        }
173
10
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
41
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.35k
        while (first != last) {
169
1.31k
            new(static_cast<void*>(dst)) T(*first);
170
1.31k
            ++dst;
171
1.31k
            ++first;
172
1.31k
        }
173
41
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
59.1k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
295k
        while (first != last) {
169
236k
            new(static_cast<void*>(dst)) T(*first);
170
236k
            ++dst;
171
236k
            ++first;
172
236k
        }
173
59.1k
    }
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
181
    void fill(T* dst, InputIterator first, InputIterator last) {
168
5.97k
        while (first != last) {
169
5.79k
            new(static_cast<void*>(dst)) T(*first);
170
5.79k
            ++dst;
171
5.79k
            ++first;
172
5.79k
        }
173
181
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
181
    void fill(T* dst, InputIterator first, InputIterator last) {
168
543
        while (first != last) {
169
362
            new(static_cast<void*>(dst)) T(*first);
170
362
            ++dst;
171
362
            ++first;
172
362
        }
173
181
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
181
    void fill(T* dst, InputIterator first, InputIterator last) {
168
362
        while (first != last) {
169
181
            new(static_cast<void*>(dst)) T(*first);
170
181
            ++dst;
171
181
            ++first;
172
181
        }
173
181
    }
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.3k
            change_capacity(n);
180
94.3k
        }
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
277
    void assign(size_type n, const T& val) {
177
277
        clear();
178
277
        if (capacity() < n) {
179
129
            change_capacity(n);
180
129
        }
181
277
        _size += n;
182
277
        fill(item_ptr(0), n, val);
183
277
    }
184
185
    template <std::input_iterator InputIterator>
186
2.03M
    void assign(InputIterator first, InputIterator last) {
187
2.03M
        size_type n = last - first;
188
2.03M
        clear();
189
2.03M
        if (capacity() < n) {
190
117k
            change_capacity(n);
191
117k
        }
192
2.03M
        _size += n;
193
2.03M
        fill(item_ptr(0), first, last);
194
2.03M
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<prevector<16u, unsigned char, unsigned int, int>::const_iterator>(prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
186
36.9k
    void assign(InputIterator first, InputIterator last) {
187
36.9k
        size_type n = last - first;
188
36.9k
        clear();
189
36.9k
        if (capacity() < n) {
190
36
            change_capacity(n);
191
36
        }
192
36.9k
        _size += n;
193
36.9k
        fill(item_ptr(0), first, last);
194
36.9k
    }
void prevector<36u, unsigned char, unsigned int, int>::assign<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
186
1.91M
    void assign(InputIterator first, InputIterator last) {
187
1.91M
        size_type n = last - first;
188
1.91M
        clear();
189
1.91M
        if (capacity() < n) {
190
116k
            change_capacity(n);
191
116k
        }
192
1.91M
        _size += n;
193
1.91M
        fill(item_ptr(0), first, last);
194
1.91M
    }
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.13k
    void assign(InputIterator first, InputIterator last) {
187
8.13k
        size_type n = last - first;
188
8.13k
        clear();
189
8.13k
        if (capacity() < n) {
190
617
            change_capacity(n);
191
617
        }
192
8.13k
        _size += n;
193
8.13k
        fill(item_ptr(0), first, last);
194
8.13k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
186
10.1k
    void assign(InputIterator first, InputIterator last) {
187
10.1k
        size_type n = last - first;
188
10.1k
        clear();
189
10.1k
        if (capacity() < n) {
190
65
            change_capacity(n);
191
65
        }
192
10.1k
        _size += n;
193
10.1k
        fill(item_ptr(0), first, last);
194
10.1k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char*>(unsigned char*, unsigned char*)
Line
Count
Source
186
10
    void assign(InputIterator first, InputIterator last) {
187
10
        size_type n = last - first;
188
10
        clear();
189
10
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
10
        _size += n;
193
10
        fill(item_ptr(0), first, last);
194
10
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
186
41
    void assign(InputIterator first, InputIterator last) {
187
41
        size_type n = last - first;
188
41
        clear();
189
41
        if (capacity() < n) {
190
40
            change_capacity(n);
191
40
        }
192
41
        _size += n;
193
41
        fill(item_ptr(0), first, last);
194
41
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char const*>(unsigned char const*, unsigned char const*)
Line
Count
Source
186
59.1k
    void assign(InputIterator first, InputIterator last) {
187
59.1k
        size_type n = last - first;
188
59.1k
        clear();
189
59.1k
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
59.1k
        _size += n;
193
59.1k
        fill(item_ptr(0), first, last);
194
59.1k
    }
195
196
79.5M
    prevector() = default;
prevector<36u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
79.0M
    prevector() = default;
prevector<33u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
498k
    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
319
    prevector() = default;
197
198
    explicit prevector(size_type n) {
199
        resize(n);
200
    }
201
202
451k
    explicit prevector(size_type n, const T& val) {
203
451k
        change_capacity(n);
204
451k
        _size += n;
205
451k
        fill(item_ptr(0), n, val);
206
451k
    }
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
332k
    explicit prevector(size_type n, const T& val) {
203
332k
        change_capacity(n);
204
332k
        _size += n;
205
332k
        fill(item_ptr(0), n, val);
206
332k
    }
207
208
    template <std::input_iterator InputIterator>
209
1.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
37.9k
    prevector(InputIterator first, InputIterator last) {
210
37.9k
        size_type n = last - first;
211
37.9k
        change_capacity(n);
212
37.9k
        _size += n;
213
37.9k
        fill(item_ptr(0), first, last);
214
37.9k
    }
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
265k
    prevector(InputIterator first, InputIterator last) {
210
265k
        size_type n = last - first;
211
265k
        change_capacity(n);
212
265k
        _size += n;
213
265k
        fill(item_ptr(0), first, last);
214
265k
    }
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
265k
    prevector(InputIterator first, InputIterator last) {
210
265k
        size_type n = last - first;
211
265k
        change_capacity(n);
212
265k
        _size += n;
213
265k
        fill(item_ptr(0), first, last);
214
265k
    }
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.84k
    prevector(InputIterator first, InputIterator last) {
210
7.84k
        size_type n = last - first;
211
7.84k
        change_capacity(n);
212
7.84k
        _size += n;
213
7.84k
        fill(item_ptr(0), first, last);
214
7.84k
    }
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
181
    prevector(InputIterator first, InputIterator last) {
210
181
        size_type n = last - first;
211
181
        change_capacity(n);
212
181
        _size += n;
213
181
        fill(item_ptr(0), first, last);
214
181
    }
215
216
46.9M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
46.9M
        size_type n = other.size();
218
46.9M
        change_capacity(n);
219
46.9M
        _size += n;
220
46.9M
        fill(item_ptr(0), other.begin(),  other.end());
221
46.9M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
1.34M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
1.34M
        size_type n = other.size();
218
1.34M
        change_capacity(n);
219
1.34M
        _size += n;
220
1.34M
        fill(item_ptr(0), other.begin(),  other.end());
221
1.34M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
45.5M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
45.5M
        size_type n = other.size();
218
45.5M
        change_capacity(n);
219
45.5M
        _size += n;
220
45.5M
        fill(item_ptr(0), other.begin(),  other.end());
221
45.5M
    }
222
223
    prevector(prevector<N, T, Size, Diff>&& other) noexcept
224
16.7M
        : _union(std::move(other._union)), _size(other._size)
225
16.7M
    {
226
16.7M
        other._size = 0;
227
16.7M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
29.3k
        : _union(std::move(other._union)), _size(other._size)
225
29.3k
    {
226
29.3k
        other._size = 0;
227
29.3k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
16.7M
        : _union(std::move(other._union)), _size(other._size)
225
16.7M
    {
226
16.7M
        other._size = 0;
227
16.7M
    }
228
229
1.97M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
1.97M
        if (&other == this) {
231
12.9k
            return *this;
232
12.9k
        }
233
1.96M
        assign(other.begin(), other.end());
234
1.96M
        return *this;
235
1.97M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
36.9k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
36.9k
        if (&other == this) {
231
2
            return *this;
232
2
        }
233
36.9k
        assign(other.begin(), other.end());
234
36.9k
        return *this;
235
36.9k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
1.93M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
1.93M
        if (&other == this) {
231
12.9k
            return *this;
232
12.9k
        }
233
1.91M
        assign(other.begin(), other.end());
234
1.91M
        return *this;
235
1.93M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int> const&)
Line
Count
Source
229
8.13k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
8.13k
        if (&other == this) {
231
0
            return *this;
232
0
        }
233
8.13k
        assign(other.begin(), other.end());
234
8.13k
        return *this;
235
8.13k
    }
236
237
31.1M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
31.1M
        if (!is_direct()) {
239
22.7k
            free(_union.indirect_contents.indirect);
240
22.7k
        }
241
31.1M
        _union = std::move(other._union);
242
31.1M
        _size = other._size;
243
31.1M
        other._size = 0;
244
31.1M
        return *this;
245
31.1M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
91.7k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
91.7k
        if (!is_direct()) {
239
8
            free(_union.indirect_contents.indirect);
240
8
        }
241
91.7k
        _union = std::move(other._union);
242
91.7k
        _size = other._size;
243
91.7k
        other._size = 0;
244
91.7k
        return *this;
245
91.7k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
31.0M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
31.0M
        if (!is_direct()) {
239
20.1k
            free(_union.indirect_contents.indirect);
240
20.1k
        }
241
31.0M
        _union = std::move(other._union);
242
31.0M
        _size = other._size;
243
31.0M
        other._size = 0;
244
31.0M
        return *this;
245
31.0M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int>&&)
Line
Count
Source
237
4.17k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
4.17k
        if (!is_direct()) {
239
2.53k
            free(_union.indirect_contents.indirect);
240
2.53k
        }
241
4.17k
        _union = std::move(other._union);
242
4.17k
        _size = other._size;
243
4.17k
        other._size = 0;
244
4.17k
        return *this;
245
4.17k
    }
246
247
1.93G
    size_type size() const {
248
1.93G
        return is_direct() ? _size : _size - N - 1;
249
1.93G
    }
prevector<36u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.91G
    size_type size() const {
248
1.91G
        return is_direct() ? _size : _size - N - 1;
249
1.91G
    }
prevector<16u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
11.1M
    size_type size() const {
248
11.1M
        return is_direct() ? _size : _size - N - 1;
249
11.1M
    }
prevector<33u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
384k
    size_type size() const {
248
384k
        return is_direct() ? _size : _size - N - 1;
249
384k
    }
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.83k
    size_type size() const {
248
1.83k
        return is_direct() ? _size : _size - N - 1;
249
1.83k
    }
prevector<35u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.26k
    size_type size() const {
248
1.26k
        return is_direct() ? _size : _size - N - 1;
249
1.26k
    }
250
251
31.4M
    bool empty() const {
252
31.4M
        return size() == 0;
253
31.4M
    }
prevector<36u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
31.1M
    bool empty() const {
252
31.1M
        return size() == 0;
253
31.1M
    }
prevector<16u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
100k
    bool empty() const {
252
100k
        return size() == 0;
253
100k
    }
prevector<8u, int, unsigned int, int>::empty() const
Line
Count
Source
251
265k
    bool empty() const {
252
265k
        return size() == 0;
253
265k
    }
prevector<4u, Network, unsigned int, int>::empty() const
Line
Count
Source
251
319
    bool empty() const {
252
319
        return size() == 0;
253
319
    }
254
255
20.2M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
15.2M
    iterator begin() { return iterator(item_ptr(0)); }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::begin()
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::begin()
prevector<8u, int, unsigned int, int>::begin()
Line
Count
Source
255
5.03M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<35u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
362
    iterator begin() { return iterator(item_ptr(0)); }
256
135M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
128M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<16u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
5.91M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<8u, int, unsigned int, int>::begin() const
Line
Count
Source
256
1.86M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
257
39.5M
    iterator end() { return iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
36.3M
    iterator end() { return iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
296k
    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
362
    iterator end() { return iterator(item_ptr(size())); }
258
1.41G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.41G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.84M
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<8u, int, unsigned int, int>::end() const
Line
Count
Source
258
1.86M
    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.5M
            return N;
263
12.5M
        } 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.2M
            return N;
263
12.2M
        } 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
106k
    size_t capacity() const {
261
106k
        if (is_direct()) {
262
106k
            return N;
263
106k
        } else {
264
10
            return _union.indirect_contents.capacity;
265
10
        }
266
106k
    }
prevector<8u, int, unsigned int, int>::capacity() const
Line
Count
Source
260
91.9k
    size_t capacity() const {
261
91.9k
        if (is_direct()) {
262
34.0k
            return N;
263
57.9k
        } else {
264
57.9k
            return _union.indirect_contents.capacity;
265
57.9k
        }
266
91.9k
    }
prevector<4u, Network, unsigned int, int>::capacity() const
Line
Count
Source
260
596
    size_t capacity() const {
261
596
        if (is_direct()) {
262
596
            return N;
263
596
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
596
    }
prevector<33u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
132k
    size_t capacity() const {
261
132k
        if (is_direct()) {
262
132k
            return N;
263
132k
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
132k
    }
prevector<35u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
362
    size_t capacity() const {
261
362
        if (is_direct()) {
262
362
            return N;
263
362
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
362
    }
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.12M
    T& operator[](size_type pos) {
269
2.12M
        return *item_ptr(pos);
270
2.12M
    }
prevector<33u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
265k
    T& operator[](size_type pos) {
269
265k
        return *item_ptr(pos);
270
265k
    }
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
319
    T& operator[](size_type pos) {
269
319
        return *item_ptr(pos);
270
319
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
5.15k
    T& operator[](size_type pos) {
269
5.15k
        return *item_ptr(pos);
270
5.15k
    }
271
272
19.6M
    const T& operator[](size_type pos) const {
273
19.6M
        return *item_ptr(pos);
274
19.6M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
11.0M
    const T& operator[](size_type pos) const {
273
11.0M
        return *item_ptr(pos);
274
11.0M
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
8.64M
    const T& operator[](size_type pos) const {
273
8.64M
        return *item_ptr(pos);
274
8.64M
    }
275
276
77.5M
    void resize(size_type new_size) {
277
77.5M
        size_type cur_size = size();
278
77.5M
        if (cur_size == new_size) {
279
66.1M
            return;
280
66.1M
        }
281
11.4M
        if (cur_size > new_size) {
282
10.8M
            erase(item_ptr(new_size), end());
283
10.8M
            return;
284
10.8M
        }
285
575k
        if (new_size > capacity()) {
286
83.5k
            change_capacity(new_size);
287
83.5k
        }
288
575k
        ptrdiff_t increase = new_size - cur_size;
289
575k
        fill(item_ptr(cur_size), increase);
290
575k
        _size += increase;
291
575k
    }
prevector<36u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
77.2M
    void resize(size_type new_size) {
277
77.2M
        size_type cur_size = size();
278
77.2M
        if (cur_size == new_size) {
279
66.1M
            return;
280
66.1M
        }
281
11.1M
        if (cur_size > new_size) {
282
10.6M
            erase(item_ptr(new_size), end());
283
10.6M
            return;
284
10.6M
        }
285
436k
        if (new_size > capacity()) {
286
82.9k
            change_capacity(new_size);
287
82.9k
        }
288
436k
        ptrdiff_t increase = new_size - cur_size;
289
436k
        fill(item_ptr(cur_size), increase);
290
436k
        _size += increase;
291
436k
    }
prevector<16u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
148k
    void resize(size_type new_size) {
277
148k
        size_type cur_size = size();
278
148k
        if (cur_size == new_size) {
279
101
            return;
280
101
        }
281
148k
        if (cur_size > new_size) {
282
148k
            erase(item_ptr(new_size), end());
283
148k
            return;
284
148k
        }
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.1k
            erase(item_ptr(new_size), end());
283
12.1k
            return;
284
12.1k
        }
285
6.58k
        if (new_size > capacity()) {
286
305
            change_capacity(new_size);
287
305
        }
288
6.58k
        ptrdiff_t increase = new_size - cur_size;
289
6.58k
        fill(item_ptr(cur_size), increase);
290
6.58k
        _size += increase;
291
6.58k
    }
prevector<33u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
132k
    void resize(size_type new_size) {
277
132k
        size_type cur_size = size();
278
132k
        if (cur_size == new_size) {
279
0
            return;
280
0
        }
281
132k
        if (cur_size > new_size) {
282
0
            erase(item_ptr(new_size), end());
283
0
            return;
284
0
        }
285
132k
        if (new_size > capacity()) {
286
0
            change_capacity(new_size);
287
0
        }
288
132k
        ptrdiff_t increase = new_size - cur_size;
289
132k
        fill(item_ptr(cur_size), increase);
290
132k
        _size += increase;
291
132k
    }
292
293
4.03k
    void reserve(size_type new_capacity) {
294
4.03k
        if (new_capacity > capacity()) {
295
1.81k
            change_capacity(new_capacity);
296
1.81k
        }
297
4.03k
    }
298
299
73.4M
    void shrink_to_fit() {
300
73.4M
        change_capacity(size());
301
73.4M
    }
prevector<36u, unsigned char, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
73.4M
    void shrink_to_fit() {
300
73.4M
        change_capacity(size());
301
73.4M
    }
prevector<8u, int, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
2.02k
    void shrink_to_fit() {
300
2.02k
        change_capacity(size());
301
2.02k
    }
302
303
76.9M
    void clear() {
304
76.9M
        resize(0);
305
76.9M
    }
prevector<36u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
76.8M
    void clear() {
304
76.8M
        resize(0);
305
76.8M
    }
prevector<16u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
106k
    void clear() {
304
106k
        resize(0);
305
106k
    }
prevector<8u, int, unsigned int, int>::clear()
Line
Count
Source
303
12.7k
    void clear() {
304
12.7k
        resize(0);
305
12.7k
    }
306
307
9.05M
    iterator insert(iterator pos, const T& value) {
308
9.05M
        size_type p = pos - begin();
309
9.05M
        size_type new_size = size() + 1;
310
9.05M
        if (capacity() < new_size) {
311
8.02k
            change_capacity(new_size + (new_size >> 1));
312
8.02k
        }
313
9.05M
        T* ptr = item_ptr(p);
314
9.05M
        T* dst = ptr + 1;
315
9.05M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.05M
        _size++;
317
9.05M
        new(static_cast<void*>(ptr)) T(value);
318
9.05M
        return iterator(ptr);
319
9.05M
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const&)
Line
Count
Source
307
9.01M
    iterator insert(iterator pos, const T& value) {
308
9.01M
        size_type p = pos - begin();
309
9.01M
        size_type new_size = size() + 1;
310
9.01M
        if (capacity() < new_size) {
311
6.65k
            change_capacity(new_size + (new_size >> 1));
312
6.65k
        }
313
9.01M
        T* ptr = item_ptr(p);
314
9.01M
        T* dst = ptr + 1;
315
9.01M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.01M
        _size++;
317
9.01M
        new(static_cast<void*>(ptr)) T(value);
318
9.01M
        return iterator(ptr);
319
9.01M
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, int const&)
Line
Count
Source
307
32.4k
    iterator insert(iterator pos, const T& value) {
308
32.4k
        size_type p = pos - begin();
309
32.4k
        size_type new_size = size() + 1;
310
32.4k
        if (capacity() < new_size) {
311
1.36k
            change_capacity(new_size + (new_size >> 1));
312
1.36k
        }
313
32.4k
        T* ptr = item_ptr(p);
314
32.4k
        T* dst = ptr + 1;
315
32.4k
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
32.4k
        _size++;
317
32.4k
        new(static_cast<void*>(ptr)) T(value);
318
32.4k
        return iterator(ptr);
319
32.4k
    }
320
321
16.4k
    void insert(iterator pos, size_type count, const T& value) {
322
16.4k
        size_type p = pos - begin();
323
16.4k
        size_type new_size = size() + count;
324
16.4k
        if (capacity() < new_size) {
325
782
            change_capacity(new_size + (new_size >> 1));
326
782
        }
327
16.4k
        T* ptr = item_ptr(p);
328
16.4k
        T* dst = ptr + count;
329
16.4k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.4k
        _size += count;
331
16.4k
        fill(item_ptr(p), count, value);
332
16.4k
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, unsigned int, int const&)
Line
Count
Source
321
16.4k
    void insert(iterator pos, size_type count, const T& value) {
322
16.4k
        size_type p = pos - begin();
323
16.4k
        size_type new_size = size() + count;
324
16.4k
        if (capacity() < new_size) {
325
775
            change_capacity(new_size + (new_size >> 1));
326
775
        }
327
16.4k
        T* ptr = item_ptr(p);
328
16.4k
        T* dst = ptr + count;
329
16.4k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.4k
        _size += count;
331
16.4k
        fill(item_ptr(p), count, value);
332
16.4k
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned int, unsigned char const&)
Line
Count
Source
321
7
    void insert(iterator pos, size_type count, const T& value) {
322
7
        size_type p = pos - begin();
323
7
        size_type new_size = size() + count;
324
7
        if (capacity() < new_size) {
325
7
            change_capacity(new_size + (new_size >> 1));
326
7
        }
327
7
        T* ptr = item_ptr(p);
328
7
        T* dst = ptr + count;
329
7
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
7
        _size += count;
331
7
        fill(item_ptr(p), count, value);
332
7
    }
333
334
    template <std::input_iterator InputIterator>
335
5.51M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
5.51M
        size_type p = pos - begin();
337
5.51M
        difference_type count = last - first;
338
5.51M
        size_type new_size = size() + count;
339
5.51M
        if (capacity() < new_size) {
340
370k
            change_capacity(new_size + (new_size >> 1));
341
370k
        }
342
5.51M
        T* ptr = item_ptr(p);
343
5.51M
        T* dst = ptr + count;
344
5.51M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
5.51M
        _size += count;
346
5.51M
        fill(ptr, first, last);
347
5.51M
    }
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.72M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.72M
        size_type p = pos - begin();
337
2.72M
        difference_type count = last - first;
338
2.72M
        size_type new_size = size() + count;
339
2.72M
        if (capacity() < new_size) {
340
224k
            change_capacity(new_size + (new_size >> 1));
341
224k
        }
342
2.72M
        T* ptr = item_ptr(p);
343
2.72M
        T* dst = ptr + count;
344
2.72M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.72M
        _size += count;
346
2.72M
        fill(ptr, first, last);
347
2.72M
    }
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.01k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
4.01k
        size_type p = pos - begin();
337
4.01k
        difference_type count = last - first;
338
4.01k
        size_type new_size = size() + count;
339
4.01k
        if (capacity() < new_size) {
340
282
            change_capacity(new_size + (new_size >> 1));
341
282
        }
342
4.01k
        T* ptr = item_ptr(p);
343
4.01k
        T* dst = ptr + count;
344
4.01k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
4.01k
        _size += count;
346
4.01k
        fill(ptr, first, last);
347
4.01k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(prevector<36u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
335
2.75k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.75k
        size_type p = pos - begin();
337
2.75k
        difference_type count = last - first;
338
2.75k
        size_type new_size = size() + count;
339
2.75k
        if (capacity() < new_size) {
340
238
            change_capacity(new_size + (new_size >> 1));
341
238
        }
342
2.75k
        T* ptr = item_ptr(p);
343
2.75k
        T* dst = ptr + count;
344
2.75k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.75k
        _size += count;
346
2.75k
        fill(ptr, first, last);
347
2.75k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
335
2.75M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.75M
        size_type p = pos - begin();
337
2.75M
        difference_type count = last - first;
338
2.75M
        size_type new_size = size() + count;
339
2.75M
        if (capacity() < new_size) {
340
128k
            change_capacity(new_size + (new_size >> 1));
341
128k
        }
342
2.75M
        T* ptr = item_ptr(p);
343
2.75M
        T* dst = ptr + count;
344
2.75M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.75M
        _size += count;
346
2.75M
        fill(ptr, first, last);
347
2.75M
    }
void prevector<35u, unsigned char, unsigned int, int>::insert<unsigned char*>(prevector<35u, unsigned char, unsigned int, int>::iterator, unsigned char*, unsigned char*)
Line
Count
Source
335
181
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
181
        size_type p = pos - begin();
337
181
        difference_type count = last - first;
338
181
        size_type new_size = size() + count;
339
181
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
181
        T* ptr = item_ptr(p);
343
181
        T* dst = ptr + count;
344
181
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
181
        _size += count;
346
181
        fill(ptr, first, last);
347
181
    }
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
181
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
181
        size_type p = pos - begin();
337
181
        difference_type count = last - first;
338
181
        size_type new_size = size() + count;
339
181
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
181
        T* ptr = item_ptr(p);
343
181
        T* dst = ptr + count;
344
181
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
181
        _size += count;
346
181
        fill(ptr, first, last);
347
181
    }
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
228k
            change_capacity(new_size);
354
228k
            _size += new_size - size();
355
228k
            return;
356
228k
        }
357
804k
        if (new_size < size()) {
358
3.05k
            erase(item_ptr(new_size), end());
359
800k
        } else {
360
800k
            _size += new_size - size();
361
800k
        }
362
804k
    }
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
227k
            change_capacity(new_size);
354
227k
            _size += new_size - size();
355
227k
            return;
356
227k
        }
357
797k
        if (new_size < size()) {
358
0
            erase(item_ptr(new_size), end());
359
797k
        } else {
360
797k
            _size += new_size - size();
361
797k
        }
362
797k
    }
prevector<8u, int, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
7.77k
    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
7.77k
        if (capacity() < new_size) {
353
1.13k
            change_capacity(new_size);
354
1.13k
            _size += new_size - size();
355
1.13k
            return;
356
1.13k
        }
357
6.63k
        if (new_size < size()) {
358
3.05k
            erase(item_ptr(new_size), end());
359
3.58k
        } else {
360
3.58k
            _size += new_size - size();
361
3.58k
        }
362
6.63k
    }
363
364
27.5k
    iterator erase(iterator pos) {
365
27.5k
        return erase(pos, pos + 1);
366
27.5k
    }
367
368
10.9M
    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
10.9M
        iterator p = first;
376
10.9M
        char* endp = (char*)&(*end());
377
10.9M
        _size -= last - p;
378
10.9M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
10.9M
        return first;
380
10.9M
    }
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
10.6M
    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
10.6M
        iterator p = first;
376
10.6M
        char* endp = (char*)&(*end());
377
10.6M
        _size -= last - p;
378
10.6M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
10.6M
        return first;
380
10.6M
    }
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
148k
    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
148k
        iterator p = first;
376
148k
        char* endp = (char*)&(*end());
377
148k
        _size -= last - p;
378
148k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
148k
        return first;
380
148k
    }
prevector<8u, int, unsigned int, int>::erase(prevector<8u, int, unsigned int, int>::iterator, prevector<8u, int, unsigned int, int>::iterator)
Line
Count
Source
368
70.3k
    iterator erase(iterator first, iterator last) {
369
        // Erase is not allowed to the change the object's capacity. That means
370
        // that when starting with an indirectly allocated prevector with
371
        // size and capacity > N, the result may be a still indirectly allocated
372
        // prevector with size <= N and capacity > N. A shrink_to_fit() call is
373
        // necessary to switch to the (more efficient) directly allocated
374
        // representation (with capacity N and size <= N).
375
70.3k
        iterator p = first;
376
70.3k
        char* endp = (char*)&(*end());
377
70.3k
        _size -= last - p;
378
70.3k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
70.3k
        return first;
380
70.3k
    }
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::erase(prevector<33u, unsigned char, unsigned int, int>::iterator, prevector<33u, unsigned char, unsigned int, int>::iterator)
381
382
    template<typename... Args>
383
81.6k
    void emplace_back(Args&&... args) {
384
81.6k
        size_type new_size = size() + 1;
385
81.6k
        if (capacity() < new_size) {
386
13.2k
            change_capacity(new_size + (new_size >> 1));
387
13.2k
        }
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.8k
    void emplace_back(Args&&... args) {
384
72.8k
        size_type new_size = size() + 1;
385
72.8k
        if (capacity() < new_size) {
386
13.0k
            change_capacity(new_size + (new_size >> 1));
387
13.0k
        }
388
72.8k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
72.8k
        _size++;
390
72.8k
    }
void prevector<8u, int, unsigned int, int>::emplace_back<int const&>(int const&)
Line
Count
Source
383
8.22k
    void emplace_back(Args&&... args) {
384
8.22k
        size_type new_size = size() + 1;
385
8.22k
        if (capacity() < new_size) {
386
215
            change_capacity(new_size + (new_size >> 1));
387
215
        }
388
8.22k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
8.22k
        _size++;
390
8.22k
    }
void prevector<4u, Network, unsigned int, int>::emplace_back<Network const&>(Network const&)
Line
Count
Source
383
596
    void emplace_back(Args&&... args) {
384
596
        size_type new_size = size() + 1;
385
596
        if (capacity() < new_size) {
386
0
            change_capacity(new_size + (new_size >> 1));
387
0
        }
388
596
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
596
        _size++;
390
596
    }
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.8k
    void push_back(const T& value) {
393
72.8k
        emplace_back(value);
394
72.8k
    }
prevector<8u, int, unsigned int, int>::push_back(int const&)
Line
Count
Source
392
8.22k
    void push_back(const T& value) {
393
8.22k
        emplace_back(value);
394
8.22k
    }
prevector<4u, Network, unsigned int, int>::push_back(Network const&)
Line
Count
Source
392
596
    void push_back(const T& value) {
393
596
        emplace_back(value);
394
596
    }
395
396
6.89k
    void pop_back() {
397
6.89k
        erase(end() - 1, end());
398
6.89k
    }
399
400
    T& front() {
401
        return *item_ptr(0);
402
    }
403
404
    const T& front() const {
405
        return *item_ptr(0);
406
    }
407
408
    T& back() {
409
        return *item_ptr(size() - 1);
410
    }
411
412
27.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
144M
    ~prevector() {
423
144M
        if (!is_direct()) {
424
2.29M
            free(_union.indirect_contents.indirect);
425
2.29M
            _union.indirect_contents.indirect = nullptr;
426
2.29M
        }
427
144M
    }
prevector<16u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
1.68M
    ~prevector() {
423
1.68M
        if (!is_direct()) {
424
1.99k
            free(_union.indirect_contents.indirect);
425
1.99k
            _union.indirect_contents.indirect = nullptr;
426
1.99k
        }
427
1.68M
    }
prevector<36u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
142M
    ~prevector() {
423
142M
        if (!is_direct()) {
424
2.09M
            free(_union.indirect_contents.indirect);
425
2.09M
            _union.indirect_contents.indirect = nullptr;
426
2.09M
        }
427
142M
    }
prevector<33u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
617k
    ~prevector() {
423
617k
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
617k
    }
prevector<8u, int, unsigned int, int>::~prevector()
Line
Count
Source
422
531k
    ~prevector() {
423
531k
        if (!is_direct()) {
424
194k
            free(_union.indirect_contents.indirect);
425
194k
            _union.indirect_contents.indirect = nullptr;
426
194k
        }
427
531k
    }
prevector<4u, Network, unsigned int, int>::~prevector()
Line
Count
Source
422
319
    ~prevector() {
423
319
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
319
    }
prevector<35u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
181
    ~prevector() {
423
181
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
181
    }
428
429
6.47M
    constexpr bool operator==(const prevector& other) const {
430
6.47M
        return std::ranges::equal(*this, other);
431
6.47M
    }
prevector<36u, unsigned char, unsigned int, int>::operator==(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
5.71M
    constexpr bool operator==(const prevector& other) const {
430
5.71M
        return std::ranges::equal(*this, other);
431
5.71M
    }
prevector<8u, int, unsigned int, int>::operator==(prevector<8u, int, unsigned int, int> const&) const
Line
Count
Source
429
531k
    constexpr bool operator==(const prevector& other) const {
430
531k
        return std::ranges::equal(*this, other);
431
531k
    }
prevector<16u, unsigned char, unsigned int, int>::operator==(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
219k
    constexpr bool operator==(const prevector& other) const {
430
219k
        return std::ranges::equal(*this, other);
431
219k
    }
432
433
21.4M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.4M
        if (size() < other.size()) {
435
894k
            return true;
436
894k
        }
437
20.5M
        if (size() > other.size()) {
438
339k
            return false;
439
339k
        }
440
20.2M
        const_iterator b1 = begin();
441
20.2M
        const_iterator b2 = other.begin();
442
20.2M
        const_iterator e1 = end();
443
126M
        while (b1 != e1) {
444
124M
            if ((*b1) < (*b2)) {
445
10.2M
                return true;
446
10.2M
            }
447
114M
            if ((*b2) < (*b1)) {
448
7.56M
                return false;
449
7.56M
            }
450
106M
            ++b1;
451
106M
            ++b2;
452
106M
        }
453
2.45M
        return false;
454
20.2M
    }
prevector<36u, unsigned char, unsigned int, int>::operator<(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
21.4M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.4M
        if (size() < other.size()) {
435
894k
            return true;
436
894k
        }
437
20.5M
        if (size() > other.size()) {
438
339k
            return false;
439
339k
        }
440
20.2M
        const_iterator b1 = begin();
441
20.2M
        const_iterator b2 = other.begin();
442
20.2M
        const_iterator e1 = end();
443
126M
        while (b1 != e1) {
444
124M
            if ((*b1) < (*b2)) {
445
10.2M
                return true;
446
10.2M
            }
447
114M
            if ((*b2) < (*b1)) {
448
7.56M
                return false;
449
7.56M
            }
450
106M
            ++b1;
451
106M
            ++b2;
452
106M
        }
453
2.42M
        return false;
454
20.2M
    }
prevector<16u, unsigned char, unsigned int, int>::operator<(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
29.0k
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
29.0k
        if (size() < other.size()) {
435
0
            return true;
436
0
        }
437
29.0k
        if (size() > other.size()) {
438
0
            return false;
439
0
        }
440
29.0k
        const_iterator b1 = begin();
441
29.0k
        const_iterator b2 = other.begin();
442
29.0k
        const_iterator e1 = end();
443
144k
        while (b1 != e1) {
444
116k
            if ((*b1) < (*b2)) {
445
554
                return true;
446
554
            }
447
115k
            if ((*b2) < (*b1)) {
448
171
                return false;
449
171
            }
450
115k
            ++b1;
451
115k
            ++b2;
452
115k
        }
453
28.2k
        return false;
454
29.0k
    }
455
456
41.2M
    size_t allocated_memory() const {
457
41.2M
        if (is_direct()) {
458
40.3M
            return 0;
459
40.3M
        } else {
460
906k
            return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity;
461
906k
        }
462
41.2M
    }
463
464
596k
    value_type* data() {
465
596k
        return item_ptr(0);
466
596k
    }
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
251k
    value_type* data() {
465
251k
        return item_ptr(0);
466
251k
    }
prevector<36u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
302k
    value_type* data() {
465
302k
        return item_ptr(0);
466
302k
    }
prevector<35u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
181
    value_type* data() {
465
181
        return item_ptr(0);
466
181
    }
467
468
31.5M
    const value_type* data() const {
469
31.5M
        return item_ptr(0);
470
31.5M
    }
prevector<36u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
28.7M
    const value_type* data() const {
469
28.7M
        return item_ptr(0);
470
28.7M
    }
prevector<16u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
2.59M
    const value_type* data() const {
469
2.59M
        return item_ptr(0);
470
2.59M
    }
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