Coverage Report

Created: 2026-06-03 10:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/tmp/bitcoin/src/prevector.h
Line
Count
Source
1
// Copyright (c) 2015-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_PREVECTOR_H
6
#define BITCOIN_PREVECTOR_H
7
8
#include <algorithm>
9
#include <cassert>
10
#include <cstddef>
11
#include <cstdint>
12
#include <cstdlib>
13
#include <cstring>
14
#include <iterator>
15
#include <type_traits>
16
#include <utility>
17
18
/** Implements a drop-in replacement for std::vector<T> which stores up to N
19
 *  elements directly (without heap allocation). The types Size and Diff are
20
 *  used to store element counts, and can be any unsigned + signed type.
21
 *
22
 *  Storage layout is either:
23
 *  - Direct allocation:
24
 *    - Size _size: the number of used elements (between 0 and N)
25
 *    - T direct[N]: an array of N elements of type T
26
 *      (only the first _size are initialized).
27
 *  - Indirect allocation:
28
 *    - Size _size: the number of used elements plus N + 1
29
 *    - Size capacity: the number of allocated elements
30
 *    - T* indirect: a pointer to an array of capacity elements of type T
31
 *      (only the first _size are initialized).
32
 *
33
 *  The data type T must be movable by memmove/realloc(). Once we switch to C++,
34
 *  move constructors can be used instead.
35
 */
36
template<unsigned int N, typename T, typename Size = uint32_t, typename Diff = int32_t>
37
class prevector {
38
    static_assert(std::is_trivially_copyable_v<T>);
39
40
public:
41
    static constexpr unsigned int STATIC_SIZE{N};
42
43
    typedef Size size_type;
44
    typedef Diff difference_type;
45
    typedef T value_type;
46
    typedef value_type& reference;
47
    typedef const value_type& const_reference;
48
    typedef value_type* pointer;
49
    typedef const value_type* const_pointer;
50
51
    class iterator {
52
        T* ptr{};
53
    public:
54
        typedef Diff difference_type;
55
        typedef T* pointer;
56
        typedef T& reference;
57
        using element_type = T;
58
        using iterator_category = std::contiguous_iterator_tag;
59
        iterator() = default;
60
90.6M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
74.0M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
1.97M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::iterator::iterator(int*)
Line
Count
Source
60
14.5M
        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
864
        iterator(T* ptr_) : ptr(ptr_) {}
61
153M
        T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
137M
        T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
3.95M
        T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
11.4M
        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
864
        T& operator*() const { return *ptr; }
62
35.7k
        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.7k
        T* operator->() const { return ptr; }
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::iterator::operator->() const
63
2.08M
        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.16M
        iterator& operator++() { ptr++; return *this; }
65
4.16M
        iterator& operator--() { ptr--; return *this; }
66
        iterator operator++(int) { iterator copy(*this); ++(*this); return copy; }
67
        iterator operator--(int) { iterator copy(*this); --(*this); return copy; }
68
27.2M
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
68
26.2M
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<16u, unsigned char, unsigned int, int>::iterator, prevector<16u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
68
659k
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<8u, int, unsigned int, int>::iterator, prevector<8u, int, unsigned int, int>::iterator)
Line
Count
Source
68
390k
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
Unexecuted instantiation: operator-(prevector<33u, unsigned char, unsigned int, int>::iterator, prevector<33u, unsigned char, unsigned int, int>::iterator)
operator-(prevector<35u, unsigned char, unsigned int, int>::iterator, prevector<35u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
68
432
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
69
4.31M
        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.08M
        iterator operator-(size_type n) const { return iterator(ptr - n); }
73
        iterator& operator-=(size_type n) { ptr -= n; return *this; }
74
44.9M
        bool operator==(iterator x) const { return ptr == x.ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator==(prevector<36u, unsigned char, unsigned int, int>::iterator) const
Line
Count
Source
74
37.8M
        bool operator==(iterator x) const { return ptr == x.ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator==(prevector<8u, int, unsigned int, int>::iterator) const
Line
Count
Source
74
7.04M
        bool operator==(iterator x) const { return ptr == x.ptr; }
75
0
        auto operator<=>(iterator x) const { return ptr <=> x.ptr; }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<16u, unsigned char, unsigned int, int>::iterator) const
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<33u, unsigned char, unsigned int, int>::iterator) const
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<36u, unsigned char, unsigned int, int>::iterator) const
Unexecuted instantiation: prevector<8u, int, unsigned int, int>::iterator::operator<=>(prevector<8u, int, unsigned int, int>::iterator) const
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::iterator::operator<=>(prevector<35u, unsigned char, unsigned int, int>::iterator) const
76
    };
77
78
    class const_iterator {
79
        const T* ptr{};
80
    public:
81
        typedef Diff difference_type;
82
        typedef const T* pointer;
83
        typedef const T& reference;
84
        using element_type = const T;
85
        using iterator_category = std::contiguous_iterator_tag;
86
        const_iterator() = default;
87
1.58G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::const_iterator::const_iterator(unsigned char const*)
Line
Count
Source
87
11.0M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::const_iterator::const_iterator(unsigned char const*)
Line
Count
Source
87
1.57G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::const_iterator::const_iterator(int const*)
Line
Count
Source
87
3.76M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
88
739k
        const_iterator(iterator x) : ptr(&(*x)) {}
89
18.0G
        const T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
17.9G
        const T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
19.1M
        const T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
16.7M
        const T& operator*() const { return *ptr; }
90
3.92M
        const T* operator->() const { return ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
3.92M
        const T* operator->() const { return ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
520
        const T* operator->() const { return ptr; }
91
179k
        const T& operator[](size_type pos) const { return ptr[pos]; }
92
16.2G
        const_iterator& operator++() { ptr++; return *this; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
16.2G
        const_iterator& operator++() { ptr++; return *this; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
13.8M
        const_iterator& operator++() { ptr++; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
12.5M
        const_iterator& operator++() { ptr++; return *this; }
93
4.16M
        const_iterator& operator--() { ptr--; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator--()
Line
Count
Source
93
4.16M
        const_iterator& operator--() { ptr--; return *this; }
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator--()
94
685M
        const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
95
        const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
96
735M
        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
733M
        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
470k
        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.10M
        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.25M
        const_iterator& operator+=(size_type n) { ptr += n; return *this; }
100
590
        const_iterator operator-(size_type n) const { return const_iterator(ptr - n); }
101
        const_iterator& operator-=(size_type n) { ptr -= n; return *this; }
102
15.4G
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator==(prevector<36u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
102
15.4G
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator==(prevector<16u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
102
16.4M
        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.8M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
103
1.36G
        auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<36u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
103
1.36G
        auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<16u, unsigned char, unsigned int, int>::const_iterator) const
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
125M
    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
114M
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
prevector<16u, unsigned char, unsigned int, int>::direct_ptr(int)
Line
Count
Source
122
8.05M
    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
681k
    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.93M
    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
132
    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.72k
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
123
287M
    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
263M
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
prevector<16u, unsigned char, unsigned int, int>::direct_ptr(int) const
Line
Count
Source
123
22.3M
    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
87.0k
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
124
34.9M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
20.4M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
2.54k
    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.5M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
Unexecuted instantiation: prevector<4u, Network, unsigned int, int>::indirect_ptr(int)
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::indirect_ptr(int)
125
1.34G
    const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }
prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int) const
Line
Count
Source
125
1.34G
    const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int) const
Line
Count
Source
125
6.33k
    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.15M
    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.14G
    bool is_direct() const { return _size <= N; }
prevector<36u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.05G
    bool is_direct() const { return _size <= N; }
prevector<16u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
58.9M
    bool is_direct() const { return _size <= N; }
prevector<33u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
1.89M
    bool is_direct() const { return _size <= N; }
prevector<8u, int, unsigned int, int>::is_direct() const
Line
Count
Source
126
29.3M
    bool is_direct() const { return _size <= N; }
prevector<4u, Network, unsigned int, int>::is_direct() const
Line
Count
Source
126
528
    bool is_direct() const { return _size <= N; }
prevector<35u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.10k
    bool is_direct() const { return _size <= N; }
127
128
131M
    void change_capacity(size_type new_capacity) {
129
131M
        if (new_capacity <= N) {
130
129M
            if (!is_direct()) {
131
45.0k
                T* indirect = indirect_ptr(0);
132
45.0k
                T* src = indirect;
133
45.0k
                T* dst = direct_ptr(0);
134
45.0k
                memcpy(dst, src, size() * sizeof(T));
135
45.0k
                free(indirect);
136
45.0k
                _size -= N + 1;
137
45.0k
            }
138
129M
        } else {
139
2.42M
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
82.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.34M
            } else {
147
2.34M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.34M
                assert(new_indirect);
149
2.34M
                T* src = direct_ptr(0);
150
2.34M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.34M
                memcpy(dst, src, size() * sizeof(T));
152
2.34M
                _union.indirect_contents.indirect = new_indirect;
153
2.34M
                _union.indirect_contents.capacity = new_capacity;
154
2.34M
                _size += N + 1;
155
2.34M
            }
156
2.42M
        }
157
131M
    }
prevector<36u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
125M
    void change_capacity(size_type new_capacity) {
129
125M
        if (new_capacity <= N) {
130
123M
            if (!is_direct()) {
131
44.4k
                T* indirect = indirect_ptr(0);
132
44.4k
                T* src = indirect;
133
44.4k
                T* dst = direct_ptr(0);
134
44.4k
                memcpy(dst, src, size() * sizeof(T));
135
44.4k
                free(indirect);
136
44.4k
                _size -= N + 1;
137
44.4k
            }
138
123M
        } else {
139
2.21M
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
78.7k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
78.7k
                assert(_union.indirect_contents.indirect);
145
78.7k
                _union.indirect_contents.capacity = new_capacity;
146
2.13M
            } else {
147
2.13M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.13M
                assert(new_indirect);
149
2.13M
                T* src = direct_ptr(0);
150
2.13M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.13M
                memcpy(dst, src, size() * sizeof(T));
152
2.13M
                _union.indirect_contents.indirect = new_indirect;
153
2.13M
                _union.indirect_contents.capacity = new_capacity;
154
2.13M
                _size += N + 1;
155
2.13M
            }
156
2.21M
        }
157
125M
    }
prevector<16u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
5.41M
    void change_capacity(size_type new_capacity) {
129
5.41M
        if (new_capacity <= N) {
130
5.41M
            if (!is_direct()) {
131
0
                T* indirect = indirect_ptr(0);
132
0
                T* src = indirect;
133
0
                T* dst = direct_ptr(0);
134
0
                memcpy(dst, src, size() * sizeof(T));
135
0
                free(indirect);
136
0
                _size -= N + 1;
137
0
            }
138
5.41M
        } else {
139
2.21k
            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.21k
            } else {
147
2.21k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.21k
                assert(new_indirect);
149
2.21k
                T* src = direct_ptr(0);
150
2.21k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.21k
                memcpy(dst, src, size() * sizeof(T));
152
2.21k
                _union.indirect_contents.indirect = new_indirect;
153
2.21k
                _union.indirect_contents.capacity = new_capacity;
154
2.21k
                _size += N + 1;
155
2.21k
            }
156
2.21k
        }
157
5.41M
    }
prevector<33u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
87.0k
    void change_capacity(size_type new_capacity) {
129
87.0k
        if (new_capacity <= N) {
130
87.0k
            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
87.0k
        } 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
87.0k
    }
prevector<8u, int, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
543k
    void change_capacity(size_type new_capacity) {
129
543k
        if (new_capacity <= N) {
130
336k
            if (!is_direct()) {
131
604
                T* indirect = indirect_ptr(0);
132
604
                T* src = indirect;
133
604
                T* dst = direct_ptr(0);
134
604
                memcpy(dst, src, size() * sizeof(T));
135
604
                free(indirect);
136
604
                _size -= N + 1;
137
604
            }
138
336k
        } else {
139
207k
            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.22k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
4.22k
                assert(_union.indirect_contents.indirect);
145
4.22k
                _union.indirect_contents.capacity = new_capacity;
146
202k
            } else {
147
202k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
202k
                assert(new_indirect);
149
202k
                T* src = direct_ptr(0);
150
202k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
202k
                memcpy(dst, src, size() * sizeof(T));
152
202k
                _union.indirect_contents.indirect = new_indirect;
153
202k
                _union.indirect_contents.capacity = new_capacity;
154
202k
                _size += N + 1;
155
202k
            }
156
207k
        }
157
543k
    }
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
216
    void change_capacity(size_type new_capacity) {
129
216
        if (new_capacity <= N) {
130
216
            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
216
        } 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
216
    }
158
159
158M
    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
132M
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<16u, unsigned char, unsigned int, int>::item_ptr(int)
Line
Count
Source
159
8.06M
    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
681k
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<8u, int, unsigned int, int>::item_ptr(int)
Line
Count
Source
159
17.2M
    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
132
    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.72k
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
160
1.63G
    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.60G
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<16u, unsigned char, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
22.3M
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<8u, int, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
3.76M
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<33u, unsigned char, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
87.0k
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
161
162
3.15M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
3.15M
        std::fill_n(dst, count, value);
164
3.15M
    }
prevector<36u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
530k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
530k
        std::fill_n(dst, count, value);
164
530k
    }
prevector<33u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
213k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
213k
        std::fill_n(dst, count, value);
164
213k
    }
prevector<16u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
2.39M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
2.39M
        std::fill_n(dst, count, value);
164
2.39M
    }
prevector<8u, int, unsigned int, int>::fill(int*, long, int const&)
Line
Count
Source
162
23.1k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
23.1k
        std::fill_n(dst, count, value);
164
23.1k
    }
165
166
    template <std::input_iterator InputIterator>
167
59.6M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.4G
        while (first != last) {
169
15.3G
            new(static_cast<void*>(dst)) T(*first);
170
15.3G
            ++dst;
171
15.3G
            ++first;
172
15.3G
        }
173
59.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.69M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
87.5M
        while (first != last) {
169
84.8M
            new(static_cast<void*>(dst)) T(*first);
170
84.8M
            ++dst;
171
84.8M
            ++first;
172
84.8M
        }
173
2.69M
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<prevector<16u, unsigned char, unsigned int, int>::const_iterator>(unsigned char*, prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
167
3.05M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.5M
        while (first != last) {
169
12.5M
            new(static_cast<void*>(dst)) T(*first);
170
12.5M
            ++dst;
171
12.5M
            ++first;
172
12.5M
        }
173
3.05M
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(unsigned char*, prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
167
52.5M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.2G
        while (first != last) {
169
15.2G
            new(static_cast<void*>(dst)) T(*first);
170
15.2G
            ++dst;
171
15.2G
            ++first;
172
15.2G
        }
173
52.5M
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
39.8k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.62M
        while (first != last) {
169
1.58M
            new(static_cast<void*>(dst)) T(*first);
170
1.58M
            ++dst;
171
1.58M
            ++first;
172
1.58M
        }
173
39.8k
    }
void prevector<33u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
1
    void fill(T* dst, InputIterator first, InputIterator last) {
168
33
        while (first != last) {
169
32
            new(static_cast<void*>(dst)) T(*first);
170
32
            ++dst;
171
32
            ++first;
172
32
        }
173
1
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<prevector<36u, unsigned char, unsigned int, int>::iterator>(unsigned char*, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
167
22.7k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
37.3M
        while (first != last) {
169
37.3M
            new(static_cast<void*>(dst)) T(*first);
170
37.3M
            ++dst;
171
37.3M
            ++first;
172
37.3M
        }
173
22.7k
    }
void prevector<8u, int, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>>(int*, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>)
Line
Count
Source
167
267k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.34M
        while (first != last) {
169
2.08M
            new(static_cast<void*>(dst)) T(*first);
170
2.08M
            ++dst;
171
2.08M
            ++first;
172
2.08M
        }
173
267k
    }
void prevector<8u, int, unsigned int, int>::fill<prevector<8u, int, unsigned int, int>::iterator>(int*, prevector<8u, int, unsigned int, int>::iterator, prevector<8u, int, unsigned int, int>::iterator)
Line
Count
Source
167
267k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.34M
        while (first != last) {
169
2.08M
            new(static_cast<void*>(dst)) T(*first);
170
2.08M
            ++dst;
171
2.08M
            ++first;
172
2.08M
        }
173
267k
    }
void prevector<8u, int, unsigned int, int>::fill<int*>(int*, int*, int*)
Line
Count
Source
167
4.16k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
14.6k
        while (first != last) {
169
10.4k
            new(static_cast<void*>(dst)) T(*first);
170
10.4k
            ++dst;
171
10.4k
            ++first;
172
10.4k
        }
173
4.16k
    }
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.20k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
55.4k
        while (first != last) {
169
47.2k
            new(static_cast<void*>(dst)) T(*first);
170
47.2k
            ++dst;
171
47.2k
            ++first;
172
47.2k
        }
173
8.20k
    }
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
194k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
29.3M
        while (first != last) {
169
29.1M
            new(static_cast<void*>(dst)) T(*first);
170
29.1M
            ++dst;
171
29.1M
            ++first;
172
29.1M
        }
173
194k
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>)
Line
Count
Source
167
7
    void fill(T* dst, InputIterator first, InputIterator last) {
168
35
        while (first != last) {
169
28
            new(static_cast<void*>(dst)) T(*first);
170
28
            ++dst;
171
28
            ++first;
172
28
        }
173
7
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>)
Line
Count
Source
167
4
    void fill(T* dst, InputIterator first, InputIterator last) {
168
36
        while (first != last) {
169
32
            new(static_cast<void*>(dst)) T(*first);
170
32
            ++dst;
171
32
            ++first;
172
32
        }
173
4
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>)
Line
Count
Source
167
6
    void fill(T* dst, InputIterator first, InputIterator last) {
168
12
        while (first != last) {
169
6
            new(static_cast<void*>(dst)) T(*first);
170
6
            ++dst;
171
6
            ++first;
172
6
        }
173
6
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
12
        while (first != last) {
169
10
            new(static_cast<void*>(dst)) T(*first);
170
10
            ++dst;
171
10
            ++first;
172
10
        }
173
2
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>)
Line
Count
Source
167
7
    void fill(T* dst, InputIterator first, InputIterator last) {
168
28
        while (first != last) {
169
21
            new(static_cast<void*>(dst)) T(*first);
170
21
            ++dst;
171
21
            ++first;
172
21
        }
173
7
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
16
        while (first != last) {
169
14
            new(static_cast<void*>(dst)) T(*first);
170
14
            ++dst;
171
14
            ++first;
172
14
        }
173
2
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
52
        while (first != last) {
169
50
            new(static_cast<void*>(dst)) T(*first);
170
50
            ++dst;
171
50
            ++first;
172
50
        }
173
2
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
167
9.99k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
90.9k
        while (first != last) {
169
80.9k
            new(static_cast<void*>(dst)) T(*first);
170
80.9k
            ++dst;
171
80.9k
            ++first;
172
80.9k
        }
173
9.99k
    }
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
573k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.86M
        while (first != last) {
169
2.29M
            new(static_cast<void*>(dst)) T(*first);
170
2.29M
            ++dst;
171
2.29M
            ++first;
172
2.29M
        }
173
573k
    }
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
216
    void fill(T* dst, InputIterator first, InputIterator last) {
168
7.12k
        while (first != last) {
169
6.91k
            new(static_cast<void*>(dst)) T(*first);
170
6.91k
            ++dst;
171
6.91k
            ++first;
172
6.91k
        }
173
216
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
216
    void fill(T* dst, InputIterator first, InputIterator last) {
168
648
        while (first != last) {
169
432
            new(static_cast<void*>(dst)) T(*first);
170
432
            ++dst;
171
432
            ++first;
172
432
        }
173
216
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
216
    void fill(T* dst, InputIterator first, InputIterator last) {
168
432
        while (first != last) {
169
216
            new(static_cast<void*>(dst)) T(*first);
170
216
            ++dst;
171
216
            ++first;
172
216
        }
173
216
    }
174
175
public:
176
144k
    void assign(size_type n, const T& val) {
177
144k
        clear();
178
144k
        if (capacity() < n) {
179
94.5k
            change_capacity(n);
180
94.5k
        }
181
144k
        _size += n;
182
144k
        fill(item_ptr(0), n, val);
183
144k
    }
prevector<36u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&)
Line
Count
Source
176
143k
    void assign(size_type n, const T& val) {
177
143k
        clear();
178
143k
        if (capacity() < n) {
179
94.4k
            change_capacity(n);
180
94.4k
        }
181
143k
        _size += n;
182
143k
        fill(item_ptr(0), n, val);
183
143k
    }
prevector<16u, unsigned char, unsigned int, int>::assign(unsigned int, unsigned char const&)
Line
Count
Source
176
6
    void assign(size_type n, const T& val) {
177
6
        clear();
178
6
        if (capacity() < n) {
179
0
            change_capacity(n);
180
0
        }
181
6
        _size += n;
182
6
        fill(item_ptr(0), n, val);
183
6
    }
prevector<8u, int, unsigned int, int>::assign(unsigned int, int const&)
Line
Count
Source
176
256
    void assign(size_type n, const T& val) {
177
256
        clear();
178
256
        if (capacity() < n) {
179
109
            change_capacity(n);
180
109
        }
181
256
        _size += n;
182
256
        fill(item_ptr(0), n, val);
183
256
    }
184
185
    template <std::input_iterator InputIterator>
186
2.61M
    void assign(InputIterator first, InputIterator last) {
187
2.61M
        size_type n = last - first;
188
2.61M
        clear();
189
2.61M
        if (capacity() < n) {
190
119k
            change_capacity(n);
191
119k
        }
192
2.61M
        _size += n;
193
2.61M
        fill(item_ptr(0), first, last);
194
2.61M
    }
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.99M
    void assign(InputIterator first, InputIterator last) {
187
1.99M
        size_type n = last - first;
188
1.99M
        clear();
189
1.99M
        if (capacity() < n) {
190
118k
            change_capacity(n);
191
118k
        }
192
1.99M
        _size += n;
193
1.99M
        fill(item_ptr(0), first, last);
194
1.99M
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<prevector<16u, unsigned char, unsigned int, int>::const_iterator>(prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
186
34.7k
    void assign(InputIterator first, InputIterator last) {
187
34.7k
        size_type n = last - first;
188
34.7k
        clear();
189
34.7k
        if (capacity() < n) {
190
37
            change_capacity(n);
191
37
        }
192
34.7k
        _size += n;
193
34.7k
        fill(item_ptr(0), first, last);
194
34.7k
    }
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.20k
    void assign(InputIterator first, InputIterator last) {
187
8.20k
        size_type n = last - first;
188
8.20k
        clear();
189
8.20k
        if (capacity() < n) {
190
641
            change_capacity(n);
191
641
        }
192
8.20k
        _size += n;
193
8.20k
        fill(item_ptr(0), first, last);
194
8.20k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
186
9.99k
    void assign(InputIterator first, InputIterator last) {
187
9.99k
        size_type n = last - first;
188
9.99k
        clear();
189
9.99k
        if (capacity() < n) {
190
61
            change_capacity(n);
191
61
        }
192
9.99k
        _size += n;
193
9.99k
        fill(item_ptr(0), first, last);
194
9.99k
    }
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
573k
    void assign(InputIterator first, InputIterator last) {
187
573k
        size_type n = last - first;
188
573k
        clear();
189
573k
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
573k
        _size += n;
193
573k
        fill(item_ptr(0), first, last);
194
573k
    }
195
196
81.8M
    prevector() = default;
prevector<36u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
81.3M
    prevector() = default;
prevector<33u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
480k
    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
28
    prevector() = default;
197
198
    explicit prevector(size_type n) {
199
        resize(n);
200
    }
201
202
2.47M
    explicit prevector(size_type n, const T& val) {
203
2.47M
        change_capacity(n);
204
2.47M
        _size += n;
205
2.47M
        fill(item_ptr(0), n, val);
206
2.47M
    }
prevector<33u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
87.0k
    explicit prevector(size_type n, const T& val) {
203
87.0k
        change_capacity(n);
204
87.0k
        _size += n;
205
87.0k
        fill(item_ptr(0), n, val);
206
87.0k
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
2.39M
    explicit prevector(size_type n, const T& val) {
203
2.39M
        change_capacity(n);
204
2.39M
        _size += n;
205
2.39M
        fill(item_ptr(0), n, val);
206
2.39M
    }
207
208
    template <std::input_iterator InputIterator>
209
1.14M
    prevector(InputIterator first, InputIterator last) {
210
1.14M
        size_type n = last - first;
211
1.14M
        change_capacity(n);
212
1.14M
        _size += n;
213
1.14M
        fill(item_ptr(0), first, last);
214
1.14M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
209
37.0k
    prevector(InputIterator first, InputIterator last) {
210
37.0k
        size_type n = last - first;
211
37.0k
        change_capacity(n);
212
37.0k
        _size += n;
213
37.0k
        fill(item_ptr(0), first, last);
214
37.0k
    }
prevector<33u, unsigned char, unsigned int, int>::prevector<unsigned char*>(unsigned char*, unsigned char*)
Line
Count
Source
209
1
    prevector(InputIterator first, InputIterator last) {
210
1
        size_type n = last - first;
211
1
        change_capacity(n);
212
1
        _size += n;
213
1
        fill(item_ptr(0), first, last);
214
1
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<unsigned char const*>(unsigned char const*, unsigned char const*)
Line
Count
Source
209
13
    prevector(InputIterator first, InputIterator last) {
210
13
        size_type n = last - first;
211
13
        change_capacity(n);
212
13
        _size += n;
213
13
        fill(item_ptr(0), first, last);
214
13
    }
prevector<8u, int, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>)
Line
Count
Source
209
267k
    prevector(InputIterator first, InputIterator last) {
210
267k
        size_type n = last - first;
211
267k
        change_capacity(n);
212
267k
        _size += n;
213
267k
        fill(item_ptr(0), first, last);
214
267k
    }
prevector<8u, int, unsigned int, int>::prevector<prevector<8u, int, unsigned int, int>::iterator>(prevector<8u, int, unsigned int, int>::iterator, prevector<8u, int, unsigned int, int>::iterator)
Line
Count
Source
209
267k
    prevector(InputIterator first, InputIterator last) {
210
267k
        size_type n = last - first;
211
267k
        change_capacity(n);
212
267k
        _size += n;
213
267k
        fill(item_ptr(0), first, last);
214
267k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
209
7.90k
    prevector(InputIterator first, InputIterator last) {
210
7.90k
        size_type n = last - first;
211
7.90k
        change_capacity(n);
212
7.90k
        _size += n;
213
7.90k
        fill(item_ptr(0), first, last);
214
7.90k
    }
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
194k
    prevector(InputIterator first, InputIterator last) {
210
194k
        size_type n = last - first;
211
194k
        change_capacity(n);
212
194k
        _size += n;
213
194k
        fill(item_ptr(0), first, last);
214
194k
    }
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
368k
    prevector(InputIterator first, InputIterator last) {
210
368k
        size_type n = last - first;
211
368k
        change_capacity(n);
212
368k
        _size += n;
213
368k
        fill(item_ptr(0), first, last);
214
368k
    }
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
216
    prevector(InputIterator first, InputIterator last) {
210
216
        size_type n = last - first;
211
216
        change_capacity(n);
212
216
        _size += n;
213
216
        fill(item_ptr(0), first, last);
214
216
    }
215
216
50.4M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
50.4M
        size_type n = other.size();
218
50.4M
        change_capacity(n);
219
50.4M
        _size += n;
220
50.4M
        fill(item_ptr(0), other.begin(),  other.end());
221
50.4M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
3.02M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
3.02M
        size_type n = other.size();
218
3.02M
        change_capacity(n);
219
3.02M
        _size += n;
220
3.02M
        fill(item_ptr(0), other.begin(),  other.end());
221
3.02M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
47.3M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
47.3M
        size_type n = other.size();
218
47.3M
        change_capacity(n);
219
47.3M
        _size += n;
220
47.3M
        fill(item_ptr(0), other.begin(),  other.end());
221
47.3M
    }
222
223
    prevector(prevector<N, T, Size, Diff>&& other) noexcept
224
16.6M
        : _union(std::move(other._union)), _size(other._size)
225
16.6M
    {
226
16.6M
        other._size = 0;
227
16.6M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
546k
        : _union(std::move(other._union)), _size(other._size)
225
546k
    {
226
546k
        other._size = 0;
227
546k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
16.1M
        : _union(std::move(other._union)), _size(other._size)
225
16.1M
    {
226
16.1M
        other._size = 0;
227
16.1M
    }
228
229
2.04M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
2.04M
        if (&other == this) {
231
12.8k
            return *this;
232
12.8k
        }
233
2.03M
        assign(other.begin(), other.end());
234
2.03M
        return *this;
235
2.04M
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
2.00M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
2.00M
        if (&other == this) {
231
12.8k
            return *this;
232
12.8k
        }
233
1.99M
        assign(other.begin(), other.end());
234
1.99M
        return *this;
235
2.00M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
34.7k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
34.7k
        if (&other == this) {
231
2
            return *this;
232
2
        }
233
34.7k
        assign(other.begin(), other.end());
234
34.7k
        return *this;
235
34.7k
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int> const&)
Line
Count
Source
229
8.20k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
8.20k
        if (&other == this) {
231
0
            return *this;
232
0
        }
233
8.20k
        assign(other.begin(), other.end());
234
8.20k
        return *this;
235
8.20k
    }
236
237
33.9M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
33.9M
        if (!is_direct()) {
239
25.5k
            free(_union.indirect_contents.indirect);
240
25.5k
        }
241
33.9M
        _union = std::move(other._union);
242
33.9M
        _size = other._size;
243
33.9M
        other._size = 0;
244
33.9M
        return *this;
245
33.9M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
605k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
605k
        if (!is_direct()) {
239
8
            free(_union.indirect_contents.indirect);
240
8
        }
241
605k
        _union = std::move(other._union);
242
605k
        _size = other._size;
243
605k
        other._size = 0;
244
605k
        return *this;
245
605k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
33.2M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
33.2M
        if (!is_direct()) {
239
22.9k
            free(_union.indirect_contents.indirect);
240
22.9k
        }
241
33.2M
        _union = std::move(other._union);
242
33.2M
        _size = other._size;
243
33.2M
        other._size = 0;
244
33.2M
        return *this;
245
33.2M
    }
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.59k
            free(_union.indirect_contents.indirect);
240
2.59k
        }
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.97G
    size_type size() const {
248
1.97G
        return is_direct() ? _size : _size - N - 1;
249
1.97G
    }
prevector<36u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.94G
    size_type size() const {
248
1.94G
        return is_direct() ? _size : _size - N - 1;
249
1.94G
    }
prevector<16u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
16.0M
    size_type size() const {
248
16.0M
        return is_direct() ? _size : _size - N - 1;
249
16.0M
    }
prevector<33u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
340k
    size_type size() const {
248
340k
        return is_direct() ? _size : _size - N - 1;
249
340k
    }
prevector<8u, int, unsigned int, int>::size() const
Line
Count
Source
247
7.12M
    size_type size() const {
248
7.12M
        return is_direct() ? _size : _size - N - 1;
249
7.12M
    }
prevector<4u, Network, unsigned int, int>::size() const
Line
Count
Source
247
264
    size_type size() const {
248
264
        return is_direct() ? _size : _size - N - 1;
249
264
    }
prevector<35u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.51k
    size_type size() const {
248
1.51k
        return is_direct() ? _size : _size - N - 1;
249
1.51k
    }
250
251
30.4M
    bool empty() const {
252
30.4M
        return size() == 0;
253
30.4M
    }
prevector<36u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
30.0M
    bool empty() const {
252
30.0M
        return size() == 0;
253
30.0M
    }
prevector<16u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
100k
    bool empty() const {
252
100k
        return size() == 0;
253
100k
    }
prevector<8u, int, unsigned int, int>::empty() const
Line
Count
Source
251
267k
    bool empty() const {
252
267k
        return size() == 0;
253
267k
    }
prevector<4u, Network, unsigned int, int>::empty() const
Line
Count
Source
251
28
    bool empty() const {
252
28
        return size() == 0;
253
28
    }
254
255
20.2M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
15.0M
    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.14M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<35u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
432
    iterator begin() { return iterator(item_ptr(0)); }
256
140M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
131M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<16u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
7.57M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<8u, int, unsigned int, int>::begin() const
Line
Count
Source
256
1.88M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
257
42.6M
    iterator end() { return iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
38.3M
    iterator end() { return iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
1.31M
    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.98M
    iterator end() { return iterator(item_ptr(size())); }
prevector<35u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
432
    iterator end() { return iterator(item_ptr(size())); }
258
1.44G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.43G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
3.52M
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<8u, int, unsigned int, int>::end() const
Line
Count
Source
258
1.88M
    const_iterator end() const { return const_iterator(item_ptr(size())); }
259
260
18.8M
    size_t capacity() const {
261
18.8M
        if (is_direct()) {
262
12.9M
            return N;
263
12.9M
        } else {
264
5.87M
            return _union.indirect_contents.capacity;
265
5.87M
        }
266
18.8M
    }
prevector<36u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
17.9M
    size_t capacity() const {
261
17.9M
        if (is_direct()) {
262
12.1M
            return N;
263
12.1M
        } else {
264
5.81M
            return _union.indirect_contents.capacity;
265
5.81M
        }
266
17.9M
    }
prevector<16u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
618k
    size_t capacity() const {
261
618k
        if (is_direct()) {
262
618k
            return N;
263
618k
        } else {
264
10
            return _union.indirect_contents.capacity;
265
10
        }
266
618k
    }
prevector<8u, int, unsigned int, int>::capacity() const
Line
Count
Source
260
92.9k
    size_t capacity() const {
261
92.9k
        if (is_direct()) {
262
34.4k
            return N;
263
58.5k
        } else {
264
58.5k
            return _union.indirect_contents.capacity;
265
58.5k
        }
266
92.9k
    }
prevector<4u, Network, unsigned int, int>::capacity() const
Line
Count
Source
260
104
    size_t capacity() const {
261
104
        if (is_direct()) {
262
104
            return N;
263
104
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
104
    }
prevector<33u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
126k
    size_t capacity() const {
261
126k
        if (is_direct()) {
262
126k
            return N;
263
126k
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
126k
    }
prevector<35u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
432
    size_t capacity() const {
261
432
        if (is_direct()) {
262
432
            return N;
263
432
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
432
    }
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
1.88M
    T& operator[](size_type pos) {
269
1.88M
        return *item_ptr(pos);
270
1.88M
    }
prevector<33u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
253k
    T& operator[](size_type pos) {
269
253k
        return *item_ptr(pos);
270
253k
    }
prevector<8u, int, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
8.47M
    T& operator[](size_type pos) {
269
8.47M
        return *item_ptr(pos);
270
8.47M
    }
prevector<4u, Network, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
28
    T& operator[](size_type pos) {
269
28
        return *item_ptr(pos);
270
28
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
5.07k
    T& operator[](size_type pos) {
269
5.07k
        return *item_ptr(pos);
270
5.07k
    }
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.1M
    const T& operator[](size_type pos) const {
273
11.1M
        return *item_ptr(pos);
274
11.1M
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
8.51M
    const T& operator[](size_type pos) const {
273
8.51M
        return *item_ptr(pos);
274
8.51M
    }
275
276
81.2M
    void resize(size_type new_size) {
277
81.2M
        size_type cur_size = size();
278
81.2M
        if (cur_size == new_size) {
279
68.3M
            return;
280
68.3M
        }
281
12.9M
        if (cur_size > new_size) {
282
12.4M
            erase(item_ptr(new_size), end());
283
12.4M
            return;
284
12.4M
        }
285
520k
        if (new_size > capacity()) {
286
80.7k
            change_capacity(new_size);
287
80.7k
        }
288
520k
        ptrdiff_t increase = new_size - cur_size;
289
520k
        fill(item_ptr(cur_size), increase);
290
520k
        _size += increase;
291
520k
    }
prevector<36u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
80.4M
    void resize(size_type new_size) {
277
80.4M
        size_type cur_size = size();
278
80.4M
        if (cur_size == new_size) {
279
68.3M
            return;
280
68.3M
        }
281
12.1M
        if (cur_size > new_size) {
282
11.7M
            erase(item_ptr(new_size), end());
283
11.7M
            return;
284
11.7M
        }
285
386k
        if (new_size > capacity()) {
286
80.2k
            change_capacity(new_size);
287
80.2k
        }
288
386k
        ptrdiff_t increase = new_size - cur_size;
289
386k
        fill(item_ptr(cur_size), increase);
290
386k
        _size += increase;
291
386k
    }
prevector<16u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
659k
    void resize(size_type new_size) {
277
659k
        size_type cur_size = size();
278
659k
        if (cur_size == new_size) {
279
101
            return;
280
101
        }
281
659k
        if (cur_size > new_size) {
282
659k
            erase(item_ptr(new_size), end());
283
659k
            return;
284
659k
        }
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.3k
    void resize(size_type new_size) {
277
29.3k
        size_type cur_size = size();
278
29.3k
        if (cur_size == new_size) {
279
10.3k
            return;
280
10.3k
        }
281
18.9k
        if (cur_size > new_size) {
282
12.2k
            erase(item_ptr(new_size), end());
283
12.2k
            return;
284
12.2k
        }
285
6.66k
        if (new_size > capacity()) {
286
309
            change_capacity(new_size);
287
309
        }
288
6.66k
        ptrdiff_t increase = new_size - cur_size;
289
6.66k
        fill(item_ptr(cur_size), increase);
290
6.66k
        _size += increase;
291
6.66k
    }
prevector<33u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
126k
    void resize(size_type new_size) {
277
126k
        size_type cur_size = size();
278
126k
        if (cur_size == new_size) {
279
0
            return;
280
0
        }
281
126k
        if (cur_size > new_size) {
282
0
            erase(item_ptr(new_size), end());
283
0
            return;
284
0
        }
285
126k
        if (new_size > capacity()) {
286
0
            change_capacity(new_size);
287
0
        }
288
126k
        ptrdiff_t increase = new_size - cur_size;
289
126k
        fill(item_ptr(cur_size), increase);
290
126k
        _size += increase;
291
126k
    }
292
293
4.17k
    void reserve(size_type new_capacity) {
294
4.17k
        if (new_capacity > capacity()) {
295
1.83k
            change_capacity(new_capacity);
296
1.83k
        }
297
4.17k
    }
298
299
76.7M
    void shrink_to_fit() {
300
76.7M
        change_capacity(size());
301
76.7M
    }
prevector<36u, unsigned char, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
76.7M
    void shrink_to_fit() {
300
76.7M
        change_capacity(size());
301
76.7M
    }
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
80.7M
    void clear() {
304
80.7M
        resize(0);
305
80.7M
    }
prevector<36u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
80.0M
    void clear() {
304
80.0M
        resize(0);
305
80.0M
    }
prevector<16u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
617k
    void clear() {
304
617k
        resize(0);
305
617k
    }
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
8.95M
    iterator insert(iterator pos, const T& value) {
308
8.95M
        size_type p = pos - begin();
309
8.95M
        size_type new_size = size() + 1;
310
8.95M
        if (capacity() < new_size) {
311
8.12k
            change_capacity(new_size + (new_size >> 1));
312
8.12k
        }
313
8.95M
        T* ptr = item_ptr(p);
314
8.95M
        T* dst = ptr + 1;
315
8.95M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
8.95M
        _size++;
317
8.95M
        new(static_cast<void*>(ptr)) T(value);
318
8.95M
        return iterator(ptr);
319
8.95M
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const&)
Line
Count
Source
307
8.92M
    iterator insert(iterator pos, const T& value) {
308
8.92M
        size_type p = pos - begin();
309
8.92M
        size_type new_size = size() + 1;
310
8.92M
        if (capacity() < new_size) {
311
6.65k
            change_capacity(new_size + (new_size >> 1));
312
6.65k
        }
313
8.92M
        T* ptr = item_ptr(p);
314
8.92M
        T* dst = ptr + 1;
315
8.92M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
8.92M
        _size++;
317
8.92M
        new(static_cast<void*>(ptr)) T(value);
318
8.92M
        return iterator(ptr);
319
8.92M
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, int const&)
Line
Count
Source
307
32.6k
    iterator insert(iterator pos, const T& value) {
308
32.6k
        size_type p = pos - begin();
309
32.6k
        size_type new_size = size() + 1;
310
32.6k
        if (capacity() < new_size) {
311
1.46k
            change_capacity(new_size + (new_size >> 1));
312
1.46k
        }
313
32.6k
        T* ptr = item_ptr(p);
314
32.6k
        T* dst = ptr + 1;
315
32.6k
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
32.6k
        _size++;
317
32.6k
        new(static_cast<void*>(ptr)) T(value);
318
32.6k
        return iterator(ptr);
319
32.6k
    }
320
321
16.2k
    void insert(iterator pos, size_type count, const T& value) {
322
16.2k
        size_type p = pos - begin();
323
16.2k
        size_type new_size = size() + count;
324
16.2k
        if (capacity() < new_size) {
325
769
            change_capacity(new_size + (new_size >> 1));
326
769
        }
327
16.2k
        T* ptr = item_ptr(p);
328
16.2k
        T* dst = ptr + count;
329
16.2k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.2k
        _size += count;
331
16.2k
        fill(item_ptr(p), count, value);
332
16.2k
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, unsigned int, int const&)
Line
Count
Source
321
16.2k
    void insert(iterator pos, size_type count, const T& value) {
322
16.2k
        size_type p = pos - begin();
323
16.2k
        size_type new_size = size() + count;
324
16.2k
        if (capacity() < new_size) {
325
762
            change_capacity(new_size + (new_size >> 1));
326
762
        }
327
16.2k
        T* ptr = item_ptr(p);
328
16.2k
        T* dst = ptr + count;
329
16.2k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.2k
        _size += count;
331
16.2k
        fill(item_ptr(p), count, value);
332
16.2k
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned int, unsigned char const&)
Line
Count
Source
321
7
    void insert(iterator pos, size_type count, const T& value) {
322
7
        size_type p = pos - begin();
323
7
        size_type new_size = size() + count;
324
7
        if (capacity() < new_size) {
325
7
            change_capacity(new_size + (new_size >> 1));
326
7
        }
327
7
        T* ptr = item_ptr(p);
328
7
        T* dst = ptr + count;
329
7
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
7
        _size += count;
331
7
        fill(item_ptr(p), count, value);
332
7
    }
333
334
    template <std::input_iterator InputIterator>
335
5.48M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
5.48M
        size_type p = pos - begin();
337
5.48M
        difference_type count = last - first;
338
5.48M
        size_type new_size = size() + count;
339
5.48M
        if (capacity() < new_size) {
340
368k
            change_capacity(new_size + (new_size >> 1));
341
368k
        }
342
5.48M
        T* ptr = item_ptr(p);
343
5.48M
        T* dst = ptr + count;
344
5.48M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
5.48M
        _size += count;
346
5.48M
        fill(ptr, first, last);
347
5.48M
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<unsigned char const*>(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const*, unsigned char const*)
Line
Count
Source
335
380
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
380
        size_type p = pos - begin();
337
380
        difference_type count = last - first;
338
380
        size_type new_size = size() + count;
339
380
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
380
        T* ptr = item_ptr(p);
343
380
        T* dst = ptr + count;
344
380
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
380
        _size += count;
346
380
        fill(ptr, first, last);
347
380
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(prevector<36u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
335
2.68M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.68M
        size_type p = pos - begin();
337
2.68M
        difference_type count = last - first;
338
2.68M
        size_type new_size = size() + count;
339
2.68M
        if (capacity() < new_size) {
340
223k
            change_capacity(new_size + (new_size >> 1));
341
223k
        }
342
2.68M
        T* ptr = item_ptr(p);
343
2.68M
        T* dst = ptr + count;
344
2.68M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.68M
        _size += count;
346
2.68M
        fill(ptr, first, last);
347
2.68M
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
335
22.7k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
22.7k
        size_type p = pos - begin();
337
22.7k
        difference_type count = last - first;
338
22.7k
        size_type new_size = size() + count;
339
22.7k
        if (capacity() < new_size) {
340
17.0k
            change_capacity(new_size + (new_size >> 1));
341
17.0k
        }
342
22.7k
        T* ptr = item_ptr(p);
343
22.7k
        T* dst = ptr + count;
344
22.7k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
22.7k
        _size += count;
346
22.7k
        fill(ptr, first, last);
347
22.7k
    }
void prevector<8u, int, unsigned int, int>::insert<int*>(prevector<8u, int, unsigned int, int>::iterator, int*, int*)
Line
Count
Source
335
4.16k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
4.16k
        size_type p = pos - begin();
337
4.16k
        difference_type count = last - first;
338
4.16k
        size_type new_size = size() + count;
339
4.16k
        if (capacity() < new_size) {
340
321
            change_capacity(new_size + (new_size >> 1));
341
321
        }
342
4.16k
        T* ptr = item_ptr(p);
343
4.16k
        T* dst = ptr + count;
344
4.16k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
4.16k
        _size += count;
346
4.16k
        fill(ptr, first, last);
347
4.16k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(prevector<36u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
335
2.74k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.74k
        size_type p = pos - begin();
337
2.74k
        difference_type count = last - first;
338
2.74k
        size_type new_size = size() + count;
339
2.74k
        if (capacity() < new_size) {
340
238
            change_capacity(new_size + (new_size >> 1));
341
238
        }
342
2.74k
        T* ptr = item_ptr(p);
343
2.74k
        T* dst = ptr + count;
344
2.74k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.74k
        _size += count;
346
2.74k
        fill(ptr, first, last);
347
2.74k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
335
2.76M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.76M
        size_type p = pos - begin();
337
2.76M
        difference_type count = last - first;
338
2.76M
        size_type new_size = size() + count;
339
2.76M
        if (capacity() < new_size) {
340
127k
            change_capacity(new_size + (new_size >> 1));
341
127k
        }
342
2.76M
        T* ptr = item_ptr(p);
343
2.76M
        T* dst = ptr + count;
344
2.76M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.76M
        _size += count;
346
2.76M
        fill(ptr, first, last);
347
2.76M
    }
void prevector<35u, unsigned char, unsigned int, int>::insert<unsigned char*>(prevector<35u, unsigned char, unsigned int, int>::iterator, unsigned char*, unsigned char*)
Line
Count
Source
335
216
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
216
        size_type p = pos - begin();
337
216
        difference_type count = last - first;
338
216
        size_type new_size = size() + count;
339
216
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
216
        T* ptr = item_ptr(p);
343
216
        T* dst = ptr + count;
344
216
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
216
        _size += count;
346
216
        fill(ptr, first, last);
347
216
    }
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
216
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
216
        size_type p = pos - begin();
337
216
        difference_type count = last - first;
338
216
        size_type new_size = size() + count;
339
216
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
216
        T* ptr = item_ptr(p);
343
216
        T* dst = ptr + count;
344
216
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
216
        _size += count;
346
216
        fill(ptr, first, last);
347
216
    }
348
349
983k
    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
983k
        if (capacity() < new_size) {
353
217k
            change_capacity(new_size);
354
217k
            _size += new_size - size();
355
217k
            return;
356
217k
        }
357
765k
        if (new_size < size()) {
358
3.26k
            erase(item_ptr(new_size), end());
359
762k
        } else {
360
762k
            _size += new_size - size();
361
762k
        }
362
765k
    }
prevector<36u, unsigned char, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
975k
    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
975k
        if (capacity() < new_size) {
353
216k
            change_capacity(new_size);
354
216k
            _size += new_size - size();
355
216k
            return;
356
216k
        }
357
758k
        if (new_size < size()) {
358
0
            erase(item_ptr(new_size), end());
359
758k
        } else {
360
758k
            _size += new_size - size();
361
758k
        }
362
758k
    }
prevector<8u, int, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
8.31k
    inline void resize_uninitialized(size_type new_size) {
350
        // resize_uninitialized changes the size of the prevector but does not initialize it.
351
        // If size < new_size, the added elements must be initialized explicitly.
352
8.31k
        if (capacity() < new_size) {
353
1.20k
            change_capacity(new_size);
354
1.20k
            _size += new_size - size();
355
1.20k
            return;
356
1.20k
        }
357
7.11k
        if (new_size < size()) {
358
3.26k
            erase(item_ptr(new_size), end());
359
3.85k
        } else {
360
3.85k
            _size += new_size - size();
361
3.85k
        }
362
7.11k
    }
363
364
27.7k
    iterator erase(iterator pos) {
365
27.7k
        return erase(pos, pos + 1);
366
27.7k
    }
367
368
12.4M
    iterator erase(iterator first, iterator last) {
369
        // Erase is not allowed to the change the object's capacity. That means
370
        // that when starting with an indirectly allocated prevector with
371
        // size and capacity > N, the result may be a still indirectly allocated
372
        // prevector with size <= N and capacity > N. A shrink_to_fit() call is
373
        // necessary to switch to the (more efficient) directly allocated
374
        // representation (with capacity N and size <= N).
375
12.4M
        iterator p = first;
376
12.4M
        char* endp = (char*)&(*end());
377
12.4M
        _size -= last - p;
378
12.4M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
12.4M
        return first;
380
12.4M
    }
prevector<36u, unsigned char, unsigned int, int>::erase(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
368
11.7M
    iterator erase(iterator first, iterator last) {
369
        // Erase is not allowed to the change the object's capacity. That means
370
        // that when starting with an indirectly allocated prevector with
371
        // size and capacity > N, the result may be a still indirectly allocated
372
        // prevector with size <= N and capacity > N. A shrink_to_fit() call is
373
        // necessary to switch to the (more efficient) directly allocated
374
        // representation (with capacity N and size <= N).
375
11.7M
        iterator p = first;
376
11.7M
        char* endp = (char*)&(*end());
377
11.7M
        _size -= last - p;
378
11.7M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
11.7M
        return first;
380
11.7M
    }
prevector<16u, unsigned char, unsigned int, int>::erase(prevector<16u, unsigned char, unsigned int, int>::iterator, prevector<16u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
368
659k
    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
659k
        iterator p = first;
376
659k
        char* endp = (char*)&(*end());
377
659k
        _size -= last - p;
378
659k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
659k
        return first;
380
659k
    }
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.4k
    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.4k
        iterator p = first;
376
70.4k
        char* endp = (char*)&(*end());
377
70.4k
        _size -= last - p;
378
70.4k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
70.4k
        return first;
380
70.4k
    }
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
73.4k
    void emplace_back(Args&&... args) {
384
73.4k
        size_type new_size = size() + 1;
385
73.4k
        if (capacity() < new_size) {
386
13.0k
            change_capacity(new_size + (new_size >> 1));
387
13.0k
        }
388
73.4k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
73.4k
        _size++;
390
73.4k
    }
void prevector<8u, int, unsigned int, int>::emplace_back<int const&>(int const&)
Line
Count
Source
383
8.10k
    void emplace_back(Args&&... args) {
384
8.10k
        size_type new_size = size() + 1;
385
8.10k
        if (capacity() < new_size) {
386
198
            change_capacity(new_size + (new_size >> 1));
387
198
        }
388
8.10k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
8.10k
        _size++;
390
8.10k
    }
void prevector<4u, Network, unsigned int, int>::emplace_back<Network const&>(Network const&)
Line
Count
Source
383
104
    void emplace_back(Args&&... args) {
384
104
        size_type new_size = size() + 1;
385
104
        if (capacity() < new_size) {
386
0
            change_capacity(new_size + (new_size >> 1));
387
0
        }
388
104
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
104
        _size++;
390
104
    }
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
73.4k
    void push_back(const T& value) {
393
73.4k
        emplace_back(value);
394
73.4k
    }
prevector<8u, int, unsigned int, int>::push_back(int const&)
Line
Count
Source
392
8.10k
    void push_back(const T& value) {
393
8.10k
        emplace_back(value);
394
8.10k
    }
prevector<4u, Network, unsigned int, int>::push_back(Network const&)
Line
Count
Source
392
104
    void push_back(const T& value) {
393
104
        emplace_back(value);
394
104
    }
395
396
6.68k
    void pop_back() {
397
6.68k
        erase(end() - 1, end());
398
6.68k
    }
399
400
    T& front() {
401
        return *item_ptr(0);
402
    }
403
404
    const T& front() const {
405
        return *item_ptr(0);
406
    }
407
408
    T& back() {
409
        return *item_ptr(size() - 1);
410
    }
411
412
27.7k
    const T& back() const {
413
27.7k
        return *item_ptr(size() - 1);
414
27.7k
    }
415
416
    void swap(prevector<N, T, Size, Diff>& other) noexcept
417
16.5k
    {
418
16.5k
        std::swap(_union, other._union);
419
16.5k
        std::swap(_size, other._size);
420
16.5k
    }
421
422
152M
    ~prevector() {
423
152M
        if (!is_direct()) {
424
2.26M
            free(_union.indirect_contents.indirect);
425
2.26M
            _union.indirect_contents.indirect = nullptr;
426
2.26M
        }
427
152M
    }
prevector<16u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
5.94M
    ~prevector() {
423
5.94M
        if (!is_direct()) {
424
2.21k
            free(_union.indirect_contents.indirect);
425
2.21k
            _union.indirect_contents.indirect = nullptr;
426
2.21k
        }
427
5.94M
    }
prevector<36u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
145M
    ~prevector() {
423
145M
        if (!is_direct()) {
424
2.06M
            free(_union.indirect_contents.indirect);
425
2.06M
            _union.indirect_contents.indirect = nullptr;
426
2.06M
        }
427
145M
    }
prevector<33u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
567k
    ~prevector() {
423
567k
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
567k
    }
prevector<8u, int, unsigned int, int>::~prevector()
Line
Count
Source
422
535k
    ~prevector() {
423
535k
        if (!is_direct()) {
424
199k
            free(_union.indirect_contents.indirect);
425
199k
            _union.indirect_contents.indirect = nullptr;
426
199k
        }
427
535k
    }
prevector<4u, Network, unsigned int, int>::~prevector()
Line
Count
Source
422
28
    ~prevector() {
423
28
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
28
    }
prevector<35u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
216
    ~prevector() {
423
216
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
216
    }
428
429
6.53M
    constexpr bool operator==(const prevector& other) const {
430
6.53M
        return std::ranges::equal(*this, other);
431
6.53M
    }
prevector<36u, unsigned char, unsigned int, int>::operator==(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
5.77M
    constexpr bool operator==(const prevector& other) const {
430
5.77M
        return std::ranges::equal(*this, other);
431
5.77M
    }
prevector<8u, int, unsigned int, int>::operator==(prevector<8u, int, unsigned int, int> const&) const
Line
Count
Source
429
534k
    constexpr bool operator==(const prevector& other) const {
430
534k
        return std::ranges::equal(*this, other);
431
534k
    }
prevector<16u, unsigned char, unsigned int, int>::operator==(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
217k
    constexpr bool operator==(const prevector& other) const {
430
217k
        return std::ranges::equal(*this, other);
431
217k
    }
432
433
21.4M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.4M
        if (size() < other.size()) {
435
783k
            return true;
436
783k
        }
437
20.6M
        if (size() > other.size()) {
438
278k
            return false;
439
278k
        }
440
20.3M
        const_iterator b1 = begin();
441
20.3M
        const_iterator b2 = other.begin();
442
20.3M
        const_iterator e1 = end();
443
132M
        while (b1 != e1) {
444
129M
            if ((*b1) < (*b2)) {
445
10.0M
                return true;
446
10.0M
            }
447
119M
            if ((*b2) < (*b1)) {
448
7.49M
                return false;
449
7.49M
            }
450
112M
            ++b1;
451
112M
            ++b2;
452
112M
        }
453
2.76M
        return false;
454
20.3M
    }
prevector<36u, unsigned char, unsigned int, int>::operator<(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
21.3M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.3M
        if (size() < other.size()) {
435
783k
            return true;
436
783k
        }
437
20.5M
        if (size() > other.size()) {
438
278k
            return false;
439
278k
        }
440
20.3M
        const_iterator b1 = begin();
441
20.3M
        const_iterator b2 = other.begin();
442
20.3M
        const_iterator e1 = end();
443
132M
        while (b1 != e1) {
444
129M
            if ((*b1) < (*b2)) {
445
10.0M
                return true;
446
10.0M
            }
447
119M
            if ((*b2) < (*b1)) {
448
7.49M
                return false;
449
7.49M
            }
450
112M
            ++b1;
451
112M
            ++b2;
452
112M
        }
453
2.73M
        return false;
454
20.3M
    }
prevector<16u, unsigned char, unsigned int, int>::operator<(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
27.9k
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
27.9k
        if (size() < other.size()) {
435
0
            return true;
436
0
        }
437
27.9k
        if (size() > other.size()) {
438
0
            return false;
439
0
        }
440
27.9k
        const_iterator b1 = begin();
441
27.9k
        const_iterator b2 = other.begin();
442
27.9k
        const_iterator e1 = end();
443
139k
        while (b1 != e1) {
444
111k
            if ((*b1) < (*b2)) {
445
481
                return true;
446
481
            }
447
111k
            if ((*b2) < (*b1)) {
448
142
                return false;
449
142
            }
450
111k
            ++b1;
451
111k
            ++b2;
452
111k
        }
453
27.2k
        return false;
454
27.9k
    }
455
456
44.4M
    size_t allocated_memory() const {
457
44.4M
        if (is_direct()) {
458
43.5M
            return 0;
459
43.5M
        } else {
460
898k
            return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity;
461
898k
        }
462
44.4M
    }
463
464
558k
    value_type* data() {
465
558k
        return item_ptr(0);
466
558k
    }
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
213k
    value_type* data() {
465
213k
        return item_ptr(0);
466
213k
    }
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
216
    value_type* data() {
465
216
        return item_ptr(0);
466
216
    }
467
468
30.9M
    const value_type* data() const {
469
30.9M
        return item_ptr(0);
470
30.9M
    }
prevector<36u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
28.1M
    const value_type* data() const {
469
28.1M
        return item_ptr(0);
470
28.1M
    }
prevector<16u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
2.70M
    const value_type* data() const {
469
2.70M
        return item_ptr(0);
470
2.70M
    }
prevector<33u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
87.0k
    const value_type* data() const {
469
87.0k
        return item_ptr(0);
470
87.0k
    }
471
};
472
473
#endif // BITCOIN_PREVECTOR_H