Coverage Report

Created: 2026-09-02 14:16

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/tmp/bitcoin/src/prevector.h
Line
Count
Source
1
// Copyright (c) 2015-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_PREVECTOR_H
6
#define BITCOIN_PREVECTOR_H
7
8
#include <algorithm>
9
#include <cassert>
10
#include <cstdint>
11
#include <cstdlib>
12
#include <cstring>
13
#include <iterator>
14
#include <new>
15
#include <type_traits>
16
#include <utility>
17
18
/** Implements a drop-in replacement for std::vector<T> which stores up to N
19
 *  elements directly (without heap allocation). The types Size and Diff are
20
 *  used to store element counts, and can be any unsigned + signed type.
21
 *
22
 *  Storage layout is either:
23
 *  - Direct allocation:
24
 *    - Size _size: the number of used elements (between 0 and N)
25
 *    - T direct[N]: an array of N elements of type T
26
 *      (only the first _size are initialized).
27
 *  - Indirect allocation:
28
 *    - Size _size: the number of used elements plus N + 1
29
 *    - Size capacity: the number of allocated elements
30
 *    - T* indirect: a pointer to an array of capacity elements of type T
31
 *      (only the first _size are initialized).
32
 *
33
 *  The data type T must be movable by memmove/realloc(). Once we switch to C++,
34
 *  move constructors can be used instead.
35
 */
36
template<unsigned int N, typename T, typename Size = uint32_t, typename Diff = int32_t>
37
class prevector {
38
    static_assert(std::is_trivially_copyable_v<T>);
39
40
public:
41
    static constexpr unsigned int STATIC_SIZE{N};
42
43
    typedef Size size_type;
44
    typedef Diff difference_type;
45
    typedef T value_type;
46
    typedef value_type& reference;
47
    typedef const value_type& const_reference;
48
    typedef value_type* pointer;
49
    typedef const value_type* const_pointer;
50
51
    class iterator {
52
        T* ptr{};
53
    public:
54
        typedef Diff difference_type;
55
        typedef T* pointer;
56
        typedef T& reference;
57
        using element_type = T;
58
        using iterator_category = std::contiguous_iterator_tag;
59
        iterator() = default;
60
96.6M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<36u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
81.2M
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
438k
        iterator(T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::iterator::iterator(int*)
Line
Count
Source
60
15.0M
        iterator(T* ptr_) : ptr(ptr_) {}
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
prevector<35u, unsigned char, unsigned int, int>::iterator::iterator(unsigned char*)
Line
Count
Source
60
848
        iterator(T* ptr_) : ptr(ptr_) {}
61
162M
        T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
150M
        T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
877k
        T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
11.8M
        T& operator*() const { return *ptr; }
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::iterator::operator*() const
prevector<35u, unsigned char, unsigned int, int>::iterator::operator*() const
Line
Count
Source
61
848
        T& operator*() const { return *ptr; }
62
35.8k
        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.8k
        T* operator->() const { return ptr; }
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::iterator::operator->() const
63
2.15M
        T& operator[](size_type pos) const { return ptr[pos]; }
64
42.0M
        iterator& operator++() { ptr++; return *this; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator++()
Line
Count
Source
64
37.7M
        iterator& operator++() { ptr++; return *this; }
prevector<8u, int, unsigned int, int>::iterator::operator++()
Line
Count
Source
64
4.30M
        iterator& operator++() { ptr++; return *this; }
65
4.30M
        iterator& operator--() { ptr--; return *this; }
66
        iterator operator++(int) { iterator copy(*this); ++(*this); return copy; }
67
        iterator operator--(int) { iterator copy(*this); --(*this); return copy; }
68
29.1M
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
68
28.6M
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<16u, unsigned char, unsigned int, int>::iterator, prevector<16u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
68
146k
        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
392k
        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
424
        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
69
4.45M
        iterator operator+(size_type n) const { return iterator(ptr + n); }
70
        iterator friend operator+(size_type n, iterator x) { return x + n; }
71
        iterator& operator+=(size_type n) { ptr += n; return *this; }
72
2.16M
        iterator operator-(size_type n) const { return iterator(ptr - n); }
73
        iterator& operator-=(size_type n) { ptr -= n; return *this; }
74
45.1M
        bool operator==(iterator x) const { return ptr == x.ptr; }
prevector<36u, unsigned char, unsigned int, int>::iterator::operator==(prevector<36u, unsigned char, unsigned int, int>::iterator) const
Line
Count
Source
74
37.8M
        bool operator==(iterator x) const { return ptr == x.ptr; }
prevector<8u, int, unsigned int, int>::iterator::operator==(prevector<8u, int, unsigned int, int>::iterator) const
Line
Count
Source
74
7.26M
        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.70G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<16u, unsigned char, unsigned int, int>::const_iterator::const_iterator(unsigned char const*)
Line
Count
Source
87
7.37M
        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.69G
        const_iterator(const T* ptr_) : ptr(ptr_) {}
prevector<8u, int, unsigned int, int>::const_iterator::const_iterator(int const*)
Line
Count
Source
87
3.77M
        const_iterator(const T* ptr_) : ptr(ptr_) {}
88
748k
        const_iterator(iterator x) : ptr(&(*x)) {}
89
18.3G
        const T& operator*() const { return *ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
18.3G
        const T& operator*() const { return *ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
11.7M
        const T& operator*() const { return *ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator*() const
Line
Count
Source
89
17.2M
        const T& operator*() const { return *ptr; }
90
3.99M
        const T* operator->() const { return ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
3.99M
        const T* operator->() const { return ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator->() const
Line
Count
Source
90
511
        const T* operator->() const { return ptr; }
91
183k
        const T& operator[](size_type pos) const { return ptr[pos]; }
92
16.4G
        const_iterator& operator++() { ptr++; return *this; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
16.4G
        const_iterator& operator++() { ptr++; return *this; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
6.36M
        const_iterator& operator++() { ptr++; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator++()
Line
Count
Source
92
12.9M
        const_iterator& operator++() { ptr++; return *this; }
93
4.30M
        const_iterator& operator--() { ptr--; return *this; }
prevector<8u, int, unsigned int, int>::const_iterator::operator--()
Line
Count
Source
93
4.30M
        const_iterator& operator--() { ptr--; return *this; }
Unexecuted instantiation: prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator--()
94
736M
        const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
95
        const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
96
788M
        difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
96
786M
        difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
96
475k
        difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
operator-(prevector<8u, int, unsigned int, int>::const_iterator, prevector<8u, int, unsigned int, int>::const_iterator)
Line
Count
Source
96
1.08M
        difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
97
6.13M
        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.34M
        const_iterator& operator+=(size_type n) { ptr += n; return *this; }
100
590
        const_iterator operator-(size_type n) const { return const_iterator(ptr - n); }
101
        const_iterator& operator-=(size_type n) { ptr -= n; return *this; }
102
15.6G
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator==(prevector<36u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
102
15.6G
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator==(prevector<16u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
102
7.17M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
prevector<8u, int, unsigned int, int>::const_iterator::operator==(prevector<8u, int, unsigned int, int>::const_iterator) const
Line
Count
Source
102
12.1M
        bool operator==(const_iterator x) const { return ptr == x.ptr; }
103
1.46G
        auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; }
Unexecuted instantiation: prevector<16u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<16u, unsigned char, unsigned int, int>::const_iterator) const
prevector<36u, unsigned char, unsigned int, int>::const_iterator::operator<=>(prevector<36u, unsigned char, unsigned int, int>::const_iterator) const
Line
Count
Source
103
1.46G
        auto operator<=>(const_iterator x) const { return ptr <=> x.ptr; }
Unexecuted instantiation: prevector<8u, int, unsigned int, int>::const_iterator::operator<=>(prevector<8u, int, unsigned int, int>::const_iterator) const
104
    };
105
106
private:
107
#pragma pack(push, 1)
108
    union direct_or_indirect {
109
        char direct[sizeof(T) * N];
110
        struct {
111
            char* indirect;
112
            size_type capacity;
113
        } indirect_contents;
114
    };
115
#pragma pack(pop)
116
    alignas(char*) direct_or_indirect _union = {};
117
    size_type _size = 0;
118
119
    static_assert(alignof(char*) % alignof(size_type) == 0 && sizeof(char*) % alignof(size_type) == 0, "size_type cannot have more restrictive alignment requirement than pointer");
120
    static_assert(alignof(char*) % alignof(T) == 0, "value_type T cannot have more restrictive alignment requirement than pointer");
121
122
133M
    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
127M
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
prevector<16u, unsigned char, unsigned int, int>::direct_ptr(int)
Line
Count
Source
122
2.08M
    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
747k
    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.94M
    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
1.22k
    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.69k
    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
123
306M
    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
287M
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
prevector<16u, unsigned char, unsigned int, int>::direct_ptr(int) const
Line
Count
Source
123
16.7M
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
prevector<8u, int, unsigned int, int>::direct_ptr(int) const
Line
Count
Source
123
1.58M
    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
119k
    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
124
35.5M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
20.4M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
2.60k
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::indirect_ptr(int)
prevector<8u, int, unsigned int, int>::indirect_ptr(int)
Line
Count
Source
124
15.0M
    T* indirect_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.indirect_contents.indirect) + pos; }
Unexecuted instantiation: prevector<4u, Network, unsigned int, int>::indirect_ptr(int)
Unexecuted instantiation: prevector<35u, unsigned char, unsigned int, int>::indirect_ptr(int)
125
1.44G
    const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }
prevector<36u, unsigned char, unsigned int, int>::indirect_ptr(int) const
Line
Count
Source
125
1.44G
    const T* indirect_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.indirect_contents.indirect) + pos; }
prevector<16u, unsigned char, unsigned int, int>::indirect_ptr(int) const
Line
Count
Source
125
6.46k
    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.18M
    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.45G
    bool is_direct() const { return _size <= N; }
prevector<36u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.39G
    bool is_direct() const { return _size <= N; }
prevector<16u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
31.4M
    bool is_direct() const { return _size <= N; }
prevector<33u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
2.10M
    bool is_direct() const { return _size <= N; }
prevector<8u, int, unsigned int, int>::is_direct() const
Line
Count
Source
126
29.9M
    bool is_direct() const { return _size <= N; }
prevector<4u, Network, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.88k
    bool is_direct() const { return _size <= N; }
prevector<35u, unsigned char, unsigned int, int>::is_direct() const
Line
Count
Source
126
4.02k
    bool is_direct() const { return _size <= N; }
127
128
141M
    void change_capacity(size_type new_capacity) {
129
141M
        if (new_capacity <= N) {
130
139M
            if (!is_direct()) {
131
44.7k
                T* indirect = indirect_ptr(0);
132
44.7k
                T* src = indirect;
133
44.7k
                T* dst = direct_ptr(0);
134
44.7k
                memcpy(dst, src, size() * sizeof(T));
135
44.7k
                free(indirect);
136
44.7k
                _size -= N + 1;
137
44.7k
            }
138
139M
        } else {
139
2.44M
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
83.2k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
83.2k
                assert(_union.indirect_contents.indirect);
145
83.2k
                _union.indirect_contents.capacity = new_capacity;
146
2.35M
            } else {
147
2.35M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.35M
                assert(new_indirect);
149
2.35M
                T* src = direct_ptr(0);
150
2.35M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.35M
                memcpy(dst, src, size() * sizeof(T));
152
2.35M
                _union.indirect_contents.indirect = new_indirect;
153
2.35M
                _union.indirect_contents.capacity = new_capacity;
154
2.35M
                _size += N + 1;
155
2.35M
            }
156
2.44M
        }
157
141M
    }
prevector<36u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
139M
    void change_capacity(size_type new_capacity) {
129
139M
        if (new_capacity <= N) {
130
137M
            if (!is_direct()) {
131
44.1k
                T* indirect = indirect_ptr(0);
132
44.1k
                T* src = indirect;
133
44.1k
                T* dst = direct_ptr(0);
134
44.1k
                memcpy(dst, src, size() * sizeof(T));
135
44.1k
                free(indirect);
136
44.1k
                _size -= N + 1;
137
44.1k
            }
138
137M
        } else {
139
2.22M
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
78.9k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
78.9k
                assert(_union.indirect_contents.indirect);
145
78.9k
                _union.indirect_contents.capacity = new_capacity;
146
2.14M
            } else {
147
2.14M
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.14M
                assert(new_indirect);
149
2.14M
                T* src = direct_ptr(0);
150
2.14M
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.14M
                memcpy(dst, src, size() * sizeof(T));
152
2.14M
                _union.indirect_contents.indirect = new_indirect;
153
2.14M
                _union.indirect_contents.capacity = new_capacity;
154
2.14M
                _size += N + 1;
155
2.14M
            }
156
2.22M
        }
157
139M
    }
prevector<16u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
1.49M
    void change_capacity(size_type new_capacity) {
129
1.49M
        if (new_capacity <= N) {
130
1.49M
            if (!is_direct()) {
131
0
                T* indirect = indirect_ptr(0);
132
0
                T* src = indirect;
133
0
                T* dst = direct_ptr(0);
134
0
                memcpy(dst, src, size() * sizeof(T));
135
0
                free(indirect);
136
0
                _size -= N + 1;
137
0
            }
138
1.49M
        } else {
139
2.27k
            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.27k
            } else {
147
2.27k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
2.27k
                assert(new_indirect);
149
2.27k
                T* src = direct_ptr(0);
150
2.27k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
2.27k
                memcpy(dst, src, size() * sizeof(T));
152
2.27k
                _union.indirect_contents.indirect = new_indirect;
153
2.27k
                _union.indirect_contents.capacity = new_capacity;
154
2.27k
                _size += N + 1;
155
2.27k
            }
156
2.27k
        }
157
1.49M
    }
prevector<33u, unsigned char, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
119k
    void change_capacity(size_type new_capacity) {
129
119k
        if (new_capacity <= N) {
130
119k
            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
119k
        } 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
119k
    }
prevector<8u, int, unsigned int, int>::change_capacity(unsigned int)
Line
Count
Source
128
545k
    void change_capacity(size_type new_capacity) {
129
545k
        if (new_capacity <= N) {
130
331k
            if (!is_direct()) {
131
630
                T* indirect = indirect_ptr(0);
132
630
                T* src = indirect;
133
630
                T* dst = direct_ptr(0);
134
630
                memcpy(dst, src, size() * sizeof(T));
135
630
                free(indirect);
136
630
                _size -= N + 1;
137
630
            }
138
331k
        } else {
139
214k
            if (!is_direct()) {
140
                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
141
                    success. These should instead use an allocator or new/delete so that handlers
142
                    are called as necessary, but performance would be slightly degraded by doing so. */
143
4.33k
                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
144
4.33k
                assert(_union.indirect_contents.indirect);
145
4.33k
                _union.indirect_contents.capacity = new_capacity;
146
210k
            } else {
147
210k
                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
148
210k
                assert(new_indirect);
149
210k
                T* src = direct_ptr(0);
150
210k
                T* dst = reinterpret_cast<T*>(new_indirect);
151
210k
                memcpy(dst, src, size() * sizeof(T));
152
210k
                _union.indirect_contents.indirect = new_indirect;
153
210k
                _union.indirect_contents.capacity = new_capacity;
154
210k
                _size += N + 1;
155
210k
            }
156
214k
        }
157
545k
    }
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
212
    void change_capacity(size_type new_capacity) {
129
212
        if (new_capacity <= N) {
130
212
            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
212
        } 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
212
    }
158
159
166M
    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
145M
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<16u, unsigned char, unsigned int, int>::item_ptr(int)
Line
Count
Source
159
2.08M
    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
747k
    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.7M
    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
1.22k
    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.69k
    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
160
1.75G
    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.73G
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<16u, unsigned char, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
16.7M
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
prevector<8u, int, unsigned int, int>::item_ptr(int) const
Line
Count
Source
160
3.77M
    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
119k
    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
161
162
1.18M
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
1.18M
        std::fill_n(dst, count, value);
164
1.18M
    }
prevector<36u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
581k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
581k
        std::fill_n(dst, count, value);
164
581k
    }
prevector<16u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
336k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
336k
        std::fill_n(dst, count, value);
164
336k
    }
prevector<33u, unsigned char, unsigned int, int>::fill(unsigned char*, long, unsigned char const&)
Line
Count
Source
162
246k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
246k
        std::fill_n(dst, count, value);
164
246k
    }
prevector<8u, int, unsigned int, int>::fill(int*, long, int const&)
Line
Count
Source
162
23.3k
    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
163
23.3k
        std::fill_n(dst, count, value);
164
23.3k
    }
165
166
    template <std::input_iterator InputIterator>
167
63.4M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.6G
        while (first != last) {
169
15.5G
            new(static_cast<void*>(dst)) T(*first);
170
15.5G
            ++dst;
171
15.5G
            ++first;
172
15.5G
        }
173
63.4M
    }
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.73M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
88.1M
        while (first != last) {
169
85.4M
            new(static_cast<void*>(dst)) T(*first);
170
85.4M
            ++dst;
171
85.4M
            ++first;
172
85.4M
        }
173
2.73M
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<prevector<16u, unsigned char, unsigned int, int>::const_iterator>(unsigned char*, prevector<16u, unsigned char, unsigned int, int>::const_iterator, prevector<16u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
167
1.19M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
6.26M
        while (first != last) {
169
5.07M
            new(static_cast<void*>(dst)) T(*first);
170
5.07M
            ++dst;
171
5.07M
            ++first;
172
5.07M
        }
173
1.19M
    }
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
58.6M
    void fill(T* dst, InputIterator first, InputIterator last) {
168
15.4G
        while (first != last) {
169
15.4G
            new(static_cast<void*>(dst)) T(*first);
170
15.4G
            ++dst;
171
15.4G
            ++first;
172
15.4G
        }
173
58.6M
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
41.0k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.65M
        while (first != last) {
169
1.61M
            new(static_cast<void*>(dst)) T(*first);
170
1.61M
            ++dst;
171
1.61M
            ++first;
172
1.61M
        }
173
41.0k
    }
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.9k
    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.9k
    }
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
268k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.42M
        while (first != last) {
169
2.15M
            new(static_cast<void*>(dst)) T(*first);
170
2.15M
            ++dst;
171
2.15M
            ++first;
172
2.15M
        }
173
268k
    }
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
268k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
2.42M
        while (first != last) {
169
2.15M
            new(static_cast<void*>(dst)) T(*first);
170
2.15M
            ++dst;
171
2.15M
            ++first;
172
2.15M
        }
173
268k
    }
void prevector<8u, int, unsigned int, int>::fill<int*>(int*, int*, int*)
Line
Count
Source
167
4.17k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
14.5k
        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.17k
    }
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.03k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
55.6k
        while (first != last) {
169
47.5k
            new(static_cast<void*>(dst)) T(*first);
170
47.5k
            ++dst;
171
47.5k
            ++first;
172
47.5k
        }
173
8.03k
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
221k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
28.7M
        while (first != last) {
169
28.5M
            new(static_cast<void*>(dst)) T(*first);
170
28.5M
            ++dst;
171
28.5M
            ++first;
172
28.5M
        }
173
221k
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>)
Line
Count
Source
167
7
    void fill(T* dst, InputIterator first, InputIterator last) {
168
35
        while (first != last) {
169
28
            new(static_cast<void*>(dst)) T(*first);
170
28
            ++dst;
171
28
            ++first;
172
28
        }
173
7
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>)
Line
Count
Source
167
4
    void fill(T* dst, InputIterator first, InputIterator last) {
168
36
        while (first != last) {
169
32
            new(static_cast<void*>(dst)) T(*first);
170
32
            ++dst;
171
32
            ++first;
172
32
        }
173
4
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>)
Line
Count
Source
167
6
    void fill(T* dst, InputIterator first, InputIterator last) {
168
12
        while (first != last) {
169
6
            new(static_cast<void*>(dst)) T(*first);
170
6
            ++dst;
171
6
            ++first;
172
6
        }
173
6
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
12
        while (first != last) {
169
10
            new(static_cast<void*>(dst)) T(*first);
170
10
            ++dst;
171
10
            ++first;
172
10
        }
173
2
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>)
Line
Count
Source
167
7
    void fill(T* dst, InputIterator first, InputIterator last) {
168
28
        while (first != last) {
169
21
            new(static_cast<void*>(dst)) T(*first);
170
21
            ++dst;
171
21
            ++first;
172
21
        }
173
7
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
16
        while (first != last) {
169
14
            new(static_cast<void*>(dst)) T(*first);
170
14
            ++dst;
171
14
            ++first;
172
14
        }
173
2
    }
void prevector<36u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>)
Line
Count
Source
167
2
    void fill(T* dst, InputIterator first, InputIterator last) {
168
52
        while (first != last) {
169
50
            new(static_cast<void*>(dst)) T(*first);
170
50
            ++dst;
171
50
            ++first;
172
50
        }
173
2
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
167
10.2k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
93.5k
        while (first != last) {
169
83.3k
            new(static_cast<void*>(dst)) T(*first);
170
83.3k
            ++dst;
171
83.3k
            ++first;
172
83.3k
        }
173
10.2k
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
10
    void fill(T* dst, InputIterator first, InputIterator last) {
168
110
        while (first != last) {
169
100
            new(static_cast<void*>(dst)) T(*first);
170
100
            ++dst;
171
100
            ++first;
172
100
        }
173
10
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
167
41
    void fill(T* dst, InputIterator first, InputIterator last) {
168
1.35k
        while (first != last) {
169
1.31k
            new(static_cast<void*>(dst)) T(*first);
170
1.31k
            ++dst;
171
1.31k
            ++first;
172
1.31k
        }
173
41
    }
void prevector<16u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
59.6k
    void fill(T* dst, InputIterator first, InputIterator last) {
168
298k
        while (first != last) {
169
238k
            new(static_cast<void*>(dst)) T(*first);
170
238k
            ++dst;
171
238k
            ++first;
172
238k
        }
173
59.6k
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(unsigned char*, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
167
212
    void fill(T* dst, InputIterator first, InputIterator last) {
168
6.99k
        while (first != last) {
169
6.78k
            new(static_cast<void*>(dst)) T(*first);
170
6.78k
            ++dst;
171
6.78k
            ++first;
172
6.78k
        }
173
212
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char*>(unsigned char*, unsigned char*, unsigned char*)
Line
Count
Source
167
212
    void fill(T* dst, InputIterator first, InputIterator last) {
168
636
        while (first != last) {
169
424
            new(static_cast<void*>(dst)) T(*first);
170
424
            ++dst;
171
424
            ++first;
172
424
        }
173
212
    }
void prevector<35u, unsigned char, unsigned int, int>::fill<unsigned char const*>(unsigned char*, unsigned char const*, unsigned char const*)
Line
Count
Source
167
212
    void fill(T* dst, InputIterator first, InputIterator last) {
168
424
        while (first != last) {
169
212
            new(static_cast<void*>(dst)) T(*first);
170
212
            ++dst;
171
212
            ++first;
172
212
        }
173
212
    }
174
175
public:
176
144k
    void assign(size_type n, const T& val) {
177
144k
        clear();
178
144k
        if (capacity() < n) {
179
94.4k
            change_capacity(n);
180
94.4k
        }
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.2k
            change_capacity(n);
180
94.2k
        }
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
268
    void assign(size_type n, const T& val) {
177
268
        clear();
178
268
        if (capacity() < n) {
179
128
            change_capacity(n);
180
128
        }
181
268
        _size += n;
182
268
        fill(item_ptr(0), n, val);
183
268
    }
184
185
    template <std::input_iterator InputIterator>
186
2.25M
    void assign(InputIterator first, InputIterator last) {
187
2.25M
        size_type n = last - first;
188
2.25M
        clear();
189
2.25M
        if (capacity() < n) {
190
123k
            change_capacity(n);
191
123k
        }
192
2.25M
        _size += n;
193
2.25M
        fill(item_ptr(0), first, last);
194
2.25M
    }
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.5k
    void assign(InputIterator first, InputIterator last) {
187
34.5k
        size_type n = last - first;
188
34.5k
        clear();
189
34.5k
        if (capacity() < n) {
190
73
            change_capacity(n);
191
73
        }
192
34.5k
        _size += n;
193
34.5k
        fill(item_ptr(0), first, last);
194
34.5k
    }
void prevector<36u, unsigned char, unsigned int, int>::assign<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
186
2.14M
    void assign(InputIterator first, InputIterator last) {
187
2.14M
        size_type n = last - first;
188
2.14M
        clear();
189
2.14M
        if (capacity() < n) {
190
122k
            change_capacity(n);
191
122k
        }
192
2.14M
        _size += n;
193
2.14M
        fill(item_ptr(0), first, last);
194
2.14M
    }
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.03k
    void assign(InputIterator first, InputIterator last) {
187
8.03k
        size_type n = last - first;
188
8.03k
        clear();
189
8.03k
        if (capacity() < n) {
190
641
            change_capacity(n);
191
641
        }
192
8.03k
        _size += n;
193
8.03k
        fill(item_ptr(0), first, last);
194
8.03k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
186
10.2k
    void assign(InputIterator first, InputIterator last) {
187
10.2k
        size_type n = last - first;
188
10.2k
        clear();
189
10.2k
        if (capacity() < n) {
190
65
            change_capacity(n);
191
65
        }
192
10.2k
        _size += n;
193
10.2k
        fill(item_ptr(0), first, last);
194
10.2k
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char*>(unsigned char*, unsigned char*)
Line
Count
Source
186
10
    void assign(InputIterator first, InputIterator last) {
187
10
        size_type n = last - first;
188
10
        clear();
189
10
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
10
        _size += n;
193
10
        fill(item_ptr(0), first, last);
194
10
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
186
41
    void assign(InputIterator first, InputIterator last) {
187
41
        size_type n = last - first;
188
41
        clear();
189
41
        if (capacity() < n) {
190
40
            change_capacity(n);
191
40
        }
192
41
        _size += n;
193
41
        fill(item_ptr(0), first, last);
194
41
    }
void prevector<16u, unsigned char, unsigned int, int>::assign<unsigned char const*>(unsigned char const*, unsigned char const*)
Line
Count
Source
186
59.6k
    void assign(InputIterator first, InputIterator last) {
187
59.6k
        size_type n = last - first;
188
59.6k
        clear();
189
59.6k
        if (capacity() < n) {
190
0
            change_capacity(n);
191
0
        }
192
59.6k
        _size += n;
193
59.6k
        fill(item_ptr(0), first, last);
194
59.6k
    }
195
196
87.9M
    prevector() = default;
prevector<36u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
87.4M
    prevector() = default;
prevector<33u, unsigned char, unsigned int, int>::prevector()
Line
Count
Source
196
500k
    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
406
    prevector() = default;
197
198
    explicit prevector(size_type n) {
199
        resize(n);
200
    }
201
202
456k
    explicit prevector(size_type n, const T& val) {
203
456k
        change_capacity(n);
204
456k
        _size += n;
205
456k
        fill(item_ptr(0), n, val);
206
456k
    }
prevector<33u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
119k
    explicit prevector(size_type n, const T& val) {
203
119k
        change_capacity(n);
204
119k
        _size += n;
205
119k
        fill(item_ptr(0), n, val);
206
119k
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(unsigned int, unsigned char const&)
Line
Count
Source
202
336k
    explicit prevector(size_type n, const T& val) {
203
336k
        change_capacity(n);
204
336k
        _size += n;
205
336k
        fill(item_ptr(0), n, val);
206
336k
    }
207
208
    template <std::input_iterator InputIterator>
209
1.18M
    prevector(InputIterator first, InputIterator last) {
210
1.18M
        size_type n = last - first;
211
1.18M
        change_capacity(n);
212
1.18M
        _size += n;
213
1.18M
        fill(item_ptr(0), first, last);
214
1.18M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
209
38.2k
    prevector(InputIterator first, InputIterator last) {
210
38.2k
        size_type n = last - first;
211
38.2k
        change_capacity(n);
212
38.2k
        _size += n;
213
38.2k
        fill(item_ptr(0), first, last);
214
38.2k
    }
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
268k
    prevector(InputIterator first, InputIterator last) {
210
268k
        size_type n = last - first;
211
268k
        change_capacity(n);
212
268k
        _size += n;
213
268k
        fill(item_ptr(0), first, last);
214
268k
    }
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
268k
    prevector(InputIterator first, InputIterator last) {
210
268k
        size_type n = last - first;
211
268k
        change_capacity(n);
212
268k
        _size += n;
213
268k
        fill(item_ptr(0), first, last);
214
268k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
209
8.25k
    prevector(InputIterator first, InputIterator last) {
210
8.25k
        size_type n = last - first;
211
8.25k
        change_capacity(n);
212
8.25k
        _size += n;
213
8.25k
        fill(item_ptr(0), first, last);
214
8.25k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
209
221k
    prevector(InputIterator first, InputIterator last) {
210
221k
        size_type n = last - first;
211
221k
        change_capacity(n);
212
221k
        _size += n;
213
221k
        fill(item_ptr(0), first, last);
214
221k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 4ul>::__iter_tag>)
Line
Count
Source
209
7
    prevector(InputIterator first, InputIterator last) {
210
7
        size_type n = last - first;
211
7
        change_capacity(n);
212
7
        _size += n;
213
7
        fill(item_ptr(0), first, last);
214
7
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 8ul>::__iter_tag>)
Line
Count
Source
209
4
    prevector(InputIterator first, InputIterator last) {
210
4
        size_type n = last - first;
211
4
        change_capacity(n);
212
4
        _size += n;
213
4
        fill(item_ptr(0), first, last);
214
4
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 1ul>::__iter_tag>)
Line
Count
Source
209
6
    prevector(InputIterator first, InputIterator last) {
210
6
        size_type n = last - first;
211
6
        change_capacity(n);
212
6
        _size += n;
213
6
        fill(item_ptr(0), first, last);
214
6
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 5ul>::__iter_tag>)
Line
Count
Source
209
2
    prevector(InputIterator first, InputIterator last) {
210
2
        size_type n = last - first;
211
2
        change_capacity(n);
212
2
        _size += n;
213
2
        fill(item_ptr(0), first, last);
214
2
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 3ul>::__iter_tag>)
Line
Count
Source
209
7
    prevector(InputIterator first, InputIterator last) {
210
7
        size_type n = last - first;
211
7
        change_capacity(n);
212
7
        _size += n;
213
7
        fill(item_ptr(0), first, last);
214
7
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 7ul>::__iter_tag>)
Line
Count
Source
209
2
    prevector(InputIterator first, InputIterator last) {
210
2
        size_type n = last - first;
211
2
        change_capacity(n);
212
2
        _size += n;
213
2
        fill(item_ptr(0), first, last);
214
2
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 25ul>::__iter_tag>)
Line
Count
Source
209
2
    prevector(InputIterator first, InputIterator last) {
210
2
        size_type n = last - first;
211
2
        change_capacity(n);
212
2
        _size += n;
213
2
        fill(item_ptr(0), first, last);
214
2
    }
prevector<36u, unsigned char, unsigned int, int>::prevector<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
209
379k
    prevector(InputIterator first, InputIterator last) {
210
379k
        size_type n = last - first;
211
379k
        change_capacity(n);
212
379k
        _size += n;
213
379k
        fill(item_ptr(0), first, last);
214
379k
    }
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
212
    prevector(InputIterator first, InputIterator last) {
210
212
        size_type n = last - first;
211
212
        change_capacity(n);
212
212
        _size += n;
213
212
        fill(item_ptr(0), first, last);
214
212
    }
215
216
54.4M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
54.4M
        size_type n = other.size();
218
54.4M
        change_capacity(n);
219
54.4M
        _size += n;
220
54.4M
        fill(item_ptr(0), other.begin(),  other.end());
221
54.4M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
1.15M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
1.15M
        size_type n = other.size();
218
1.15M
        change_capacity(n);
219
1.15M
        _size += n;
220
1.15M
        fill(item_ptr(0), other.begin(),  other.end());
221
1.15M
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
216
53.3M
    prevector(const prevector<N, T, Size, Diff>& other) {
217
53.3M
        size_type n = other.size();
218
53.3M
        change_capacity(n);
219
53.3M
        _size += n;
220
53.3M
        fill(item_ptr(0), other.begin(),  other.end());
221
53.3M
    }
222
223
    prevector(prevector<N, T, Size, Diff>&& other) noexcept
224
16.3M
        : _union(std::move(other._union)), _size(other._size)
225
16.3M
    {
226
16.3M
        other._size = 0;
227
16.3M
    }
prevector<16u, unsigned char, unsigned int, int>::prevector(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
29.5k
        : _union(std::move(other._union)), _size(other._size)
225
29.5k
    {
226
29.5k
        other._size = 0;
227
29.5k
    }
prevector<36u, unsigned char, unsigned int, int>::prevector(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
224
16.3M
        : _union(std::move(other._union)), _size(other._size)
225
16.3M
    {
226
16.3M
        other._size = 0;
227
16.3M
    }
228
229
2.19M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
2.19M
        if (&other == this) {
231
13.0k
            return *this;
232
13.0k
        }
233
2.18M
        assign(other.begin(), other.end());
234
2.18M
        return *this;
235
2.19M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
34.5k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
34.5k
        if (&other == this) {
231
2
            return *this;
232
2
        }
233
34.5k
        assign(other.begin(), other.end());
234
34.5k
        return *this;
235
34.5k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int> const&)
Line
Count
Source
229
2.15M
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
2.15M
        if (&other == this) {
231
13.0k
            return *this;
232
13.0k
        }
233
2.14M
        assign(other.begin(), other.end());
234
2.14M
        return *this;
235
2.15M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int> const&)
Line
Count
Source
229
8.03k
    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
230
8.03k
        if (&other == this) {
231
0
            return *this;
232
0
        }
233
8.03k
        assign(other.begin(), other.end());
234
8.03k
        return *this;
235
8.03k
    }
236
237
38.7M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
38.7M
        if (!is_direct()) {
239
24.7k
            free(_union.indirect_contents.indirect);
240
24.7k
        }
241
38.7M
        _union = std::move(other._union);
242
38.7M
        _size = other._size;
243
38.7M
        other._size = 0;
244
38.7M
        return *this;
245
38.7M
    }
prevector<16u, unsigned char, unsigned int, int>::operator=(prevector<16u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
92.4k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
92.4k
        if (!is_direct()) {
239
8
            free(_union.indirect_contents.indirect);
240
8
        }
241
92.4k
        _union = std::move(other._union);
242
92.4k
        _size = other._size;
243
92.4k
        other._size = 0;
244
92.4k
        return *this;
245
92.4k
    }
prevector<36u, unsigned char, unsigned int, int>::operator=(prevector<36u, unsigned char, unsigned int, int>&&)
Line
Count
Source
237
38.7M
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
38.7M
        if (!is_direct()) {
239
22.2k
            free(_union.indirect_contents.indirect);
240
22.2k
        }
241
38.7M
        _union = std::move(other._union);
242
38.7M
        _size = other._size;
243
38.7M
        other._size = 0;
244
38.7M
        return *this;
245
38.7M
    }
prevector<8u, int, unsigned int, int>::operator=(prevector<8u, int, unsigned int, int>&&)
Line
Count
Source
237
4.05k
    prevector& operator=(prevector<N, T, Size, Diff>&& other) noexcept {
238
4.05k
        if (!is_direct()) {
239
2.53k
            free(_union.indirect_contents.indirect);
240
2.53k
        }
241
4.05k
        _union = std::move(other._union);
242
4.05k
        _size = other._size;
243
4.05k
        other._size = 0;
244
4.05k
        return *this;
245
4.05k
    }
246
247
2.12G
    size_type size() const {
248
2.12G
        return is_direct() ? _size : _size - N - 1;
249
2.12G
    }
prevector<36u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
2.10G
    size_type size() const {
248
2.10G
        return is_direct() ? _size : _size - N - 1;
249
2.10G
    }
prevector<16u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
9.44M
    size_type size() const {
248
9.44M
        return is_direct() ? _size : _size - N - 1;
249
9.44M
    }
prevector<33u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
373k
    size_type size() const {
248
373k
        return is_direct() ? _size : _size - N - 1;
249
373k
    }
prevector<8u, int, unsigned int, int>::size() const
Line
Count
Source
247
7.22M
    size_type size() const {
248
7.22M
        return is_direct() ? _size : _size - N - 1;
249
7.22M
    }
prevector<4u, Network, unsigned int, int>::size() const
Line
Count
Source
247
2.44k
    size_type size() const {
248
2.44k
        return is_direct() ? _size : _size - N - 1;
249
2.44k
    }
prevector<35u, unsigned char, unsigned int, int>::size() const
Line
Count
Source
247
1.48k
    size_type size() const {
248
1.48k
        return is_direct() ? _size : _size - N - 1;
249
1.48k
    }
250
251
35.4M
    bool empty() const {
252
35.4M
        return size() == 0;
253
35.4M
    }
prevector<36u, unsigned char, unsigned int, int>::empty() const
Line
Count
Source
251
35.0M
    bool empty() const {
252
35.0M
        return size() == 0;
253
35.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
268k
    bool empty() const {
252
268k
        return size() == 0;
253
268k
    }
prevector<4u, Network, unsigned int, int>::empty() const
Line
Count
Source
251
406
    bool empty() const {
252
406
        return size() == 0;
253
406
    }
254
255
20.9M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
15.6M
    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.28M
    iterator begin() { return iterator(item_ptr(0)); }
prevector<35u, unsigned char, unsigned int, int>::begin()
Line
Count
Source
255
424
    iterator begin() { return iterator(item_ptr(0)); }
256
149M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<36u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
142M
    const_iterator begin() const { return const_iterator(item_ptr(0)); }
prevector<16u, unsigned char, unsigned int, int>::begin() const
Line
Count
Source
256
5.71M
    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
45.9M
    iterator end() { return iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
42.5M
    iterator end() { return iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
292k
    iterator end() { return iterator(item_ptr(size())); }
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::end()
prevector<8u, int, unsigned int, int>::end()
Line
Count
Source
257
3.05M
    iterator end() { return iterator(item_ptr(size())); }
prevector<35u, unsigned char, unsigned int, int>::end()
Line
Count
Source
257
424
    iterator end() { return iterator(item_ptr(size())); }
258
1.54G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<36u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.54G
    const_iterator end() const { return const_iterator(item_ptr(size())); }
prevector<16u, unsigned char, unsigned int, int>::end() const
Line
Count
Source
258
1.66M
    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
19.1M
    size_t capacity() const {
261
19.1M
        if (is_direct()) {
262
13.2M
            return N;
263
13.2M
        } else {
264
5.88M
            return _union.indirect_contents.capacity;
265
5.88M
        }
266
19.1M
    }
prevector<36u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
18.7M
    size_t capacity() const {
261
18.7M
        if (is_direct()) {
262
12.9M
            return N;
263
12.9M
        } else {
264
5.82M
            return _union.indirect_contents.capacity;
265
5.82M
        }
266
18.7M
    }
prevector<16u, unsigned char, unsigned int, int>::capacity() const
Line
Count
Source
260
104k
    size_t capacity() const {
261
104k
        if (is_direct()) {
262
104k
            return N;
263
104k
        } else {
264
10
            return _union.indirect_contents.capacity;
265
10
        }
266
104k
    }
prevector<8u, int, unsigned int, int>::capacity() const
Line
Count
Source
260
93.1k
    size_t capacity() const {
261
93.1k
        if (is_direct()) {
262
34.1k
            return N;
263
58.9k
        } else {
264
58.9k
            return _union.indirect_contents.capacity;
265
58.9k
        }
266
93.1k
    }
prevector<4u, Network, unsigned int, int>::capacity() const
Line
Count
Source
260
814
    size_t capacity() const {
261
814
        if (is_direct()) {
262
814
            return N;
263
814
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
814
    }
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
424
    size_t capacity() const {
261
424
        if (is_direct()) {
262
424
            return N;
263
424
        } else {
264
0
            return _union.indirect_contents.capacity;
265
0
        }
266
424
    }
267
268
11.1M
    T& operator[](size_type pos) {
269
11.1M
        return *item_ptr(pos);
270
11.1M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
2.10M
    T& operator[](size_type pos) {
269
2.10M
        return *item_ptr(pos);
270
2.10M
    }
prevector<33u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
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.75M
    T& operator[](size_type pos) {
269
8.75M
        return *item_ptr(pos);
270
8.75M
    }
prevector<4u, Network, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
406
    T& operator[](size_type pos) {
269
406
        return *item_ptr(pos);
270
406
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int)
Line
Count
Source
268
5.27k
    T& operator[](size_type pos) {
269
5.27k
        return *item_ptr(pos);
270
5.27k
    }
271
272
18.5M
    const T& operator[](size_type pos) const {
273
18.5M
        return *item_ptr(pos);
274
18.5M
    }
prevector<36u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
11.3M
    const T& operator[](size_type pos) const {
273
11.3M
        return *item_ptr(pos);
274
11.3M
    }
prevector<16u, unsigned char, unsigned int, int>::operator[](unsigned int) const
Line
Count
Source
272
7.17M
    const T& operator[](size_type pos) const {
273
7.17M
        return *item_ptr(pos);
274
7.17M
    }
275
276
88.7M
    void resize(size_type new_size) {
277
88.7M
        size_type cur_size = size();
278
88.7M
        if (cur_size == new_size) {
279
74.4M
            return;
280
74.4M
        }
281
14.3M
        if (cur_size > new_size) {
282
13.7M
            erase(item_ptr(new_size), end());
283
13.7M
            return;
284
13.7M
        }
285
571k
        if (new_size > capacity()) {
286
77.3k
            change_capacity(new_size);
287
77.3k
        }
288
571k
        ptrdiff_t increase = new_size - cur_size;
289
571k
        fill(item_ptr(cur_size), increase);
290
571k
        _size += increase;
291
571k
    }
prevector<36u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
88.4M
    void resize(size_type new_size) {
277
88.4M
        size_type cur_size = size();
278
88.4M
        if (cur_size == new_size) {
279
74.4M
            return;
280
74.4M
        }
281
14.0M
        if (cur_size > new_size) {
282
13.5M
            erase(item_ptr(new_size), end());
283
13.5M
            return;
284
13.5M
        }
285
437k
        if (new_size > capacity()) {
286
76.7k
            change_capacity(new_size);
287
76.7k
        }
288
437k
        ptrdiff_t increase = new_size - cur_size;
289
437k
        fill(item_ptr(cur_size), increase);
290
437k
        _size += increase;
291
437k
    }
prevector<16u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
146k
    void resize(size_type new_size) {
277
146k
        size_type cur_size = size();
278
146k
        if (cur_size == new_size) {
279
101
            return;
280
101
        }
281
146k
        if (cur_size > new_size) {
282
146k
            erase(item_ptr(new_size), end());
283
146k
            return;
284
146k
        }
285
284
        if (new_size > capacity()) {
286
282
            change_capacity(new_size);
287
282
        }
288
284
        ptrdiff_t increase = new_size - cur_size;
289
284
        fill(item_ptr(cur_size), increase);
290
284
        _size += increase;
291
284
    }
prevector<8u, int, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
28.8k
    void resize(size_type new_size) {
277
28.8k
        size_type cur_size = size();
278
28.8k
        if (cur_size == new_size) {
279
10.2k
            return;
280
10.2k
        }
281
18.6k
        if (cur_size > new_size) {
282
12.1k
            erase(item_ptr(new_size), end());
283
12.1k
            return;
284
12.1k
        }
285
6.50k
        if (new_size > capacity()) {
286
320
            change_capacity(new_size);
287
320
        }
288
6.50k
        ptrdiff_t increase = new_size - cur_size;
289
6.50k
        fill(item_ptr(cur_size), increase);
290
6.50k
        _size += increase;
291
6.50k
    }
prevector<33u, unsigned char, unsigned int, int>::resize(unsigned int)
Line
Count
Source
276
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.10k
    void reserve(size_type new_capacity) {
294
4.10k
        if (new_capacity > capacity()) {
295
1.75k
            change_capacity(new_capacity);
296
1.75k
        }
297
4.10k
    }
298
299
84.4M
    void shrink_to_fit() {
300
84.4M
        change_capacity(size());
301
84.4M
    }
prevector<36u, unsigned char, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
84.4M
    void shrink_to_fit() {
300
84.4M
        change_capacity(size());
301
84.4M
    }
prevector<8u, int, unsigned int, int>::shrink_to_fit()
Line
Count
Source
299
2.09k
    void shrink_to_fit() {
300
2.09k
        change_capacity(size());
301
2.09k
    }
302
303
88.1M
    void clear() {
304
88.1M
        resize(0);
305
88.1M
    }
prevector<36u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
88.0M
    void clear() {
304
88.0M
        resize(0);
305
88.0M
    }
prevector<16u, unsigned char, unsigned int, int>::clear()
Line
Count
Source
303
104k
    void clear() {
304
104k
        resize(0);
305
104k
    }
prevector<8u, int, unsigned int, int>::clear()
Line
Count
Source
303
12.4k
    void clear() {
304
12.4k
        resize(0);
305
12.4k
    }
306
307
9.45M
    iterator insert(iterator pos, const T& value) {
308
9.45M
        size_type p = pos - begin();
309
9.45M
        size_type new_size = size() + 1;
310
9.45M
        if (capacity() < new_size) {
311
8.11k
            change_capacity(new_size + (new_size >> 1));
312
8.11k
        }
313
9.45M
        T* ptr = item_ptr(p);
314
9.45M
        T* dst = ptr + 1;
315
9.45M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.45M
        _size++;
317
9.45M
        new(static_cast<void*>(ptr)) T(value);
318
9.45M
        return iterator(ptr);
319
9.45M
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const&)
Line
Count
Source
307
9.42M
    iterator insert(iterator pos, const T& value) {
308
9.42M
        size_type p = pos - begin();
309
9.42M
        size_type new_size = size() + 1;
310
9.42M
        if (capacity() < new_size) {
311
6.65k
            change_capacity(new_size + (new_size >> 1));
312
6.65k
        }
313
9.42M
        T* ptr = item_ptr(p);
314
9.42M
        T* dst = ptr + 1;
315
9.42M
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
9.42M
        _size++;
317
9.42M
        new(static_cast<void*>(ptr)) T(value);
318
9.42M
        return iterator(ptr);
319
9.42M
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, int const&)
Line
Count
Source
307
32.7k
    iterator insert(iterator pos, const T& value) {
308
32.7k
        size_type p = pos - begin();
309
32.7k
        size_type new_size = size() + 1;
310
32.7k
        if (capacity() < new_size) {
311
1.45k
            change_capacity(new_size + (new_size >> 1));
312
1.45k
        }
313
32.7k
        T* ptr = item_ptr(p);
314
32.7k
        T* dst = ptr + 1;
315
32.7k
        memmove(dst, ptr, (size() - p) * sizeof(T));
316
32.7k
        _size++;
317
32.7k
        new(static_cast<void*>(ptr)) T(value);
318
32.7k
        return iterator(ptr);
319
32.7k
    }
320
321
16.5k
    void insert(iterator pos, size_type count, const T& value) {
322
16.5k
        size_type p = pos - begin();
323
16.5k
        size_type new_size = size() + count;
324
16.5k
        if (capacity() < new_size) {
325
833
            change_capacity(new_size + (new_size >> 1));
326
833
        }
327
16.5k
        T* ptr = item_ptr(p);
328
16.5k
        T* dst = ptr + count;
329
16.5k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.5k
        _size += count;
331
16.5k
        fill(item_ptr(p), count, value);
332
16.5k
    }
prevector<8u, int, unsigned int, int>::insert(prevector<8u, int, unsigned int, int>::iterator, unsigned int, int const&)
Line
Count
Source
321
16.5k
    void insert(iterator pos, size_type count, const T& value) {
322
16.5k
        size_type p = pos - begin();
323
16.5k
        size_type new_size = size() + count;
324
16.5k
        if (capacity() < new_size) {
325
826
            change_capacity(new_size + (new_size >> 1));
326
826
        }
327
16.5k
        T* ptr = item_ptr(p);
328
16.5k
        T* dst = ptr + count;
329
16.5k
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
16.5k
        _size += count;
331
16.5k
        fill(item_ptr(p), count, value);
332
16.5k
    }
prevector<36u, unsigned char, unsigned int, int>::insert(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned int, unsigned char const&)
Line
Count
Source
321
7
    void insert(iterator pos, size_type count, const T& value) {
322
7
        size_type p = pos - begin();
323
7
        size_type new_size = size() + count;
324
7
        if (capacity() < new_size) {
325
7
            change_capacity(new_size + (new_size >> 1));
326
7
        }
327
7
        T* ptr = item_ptr(p);
328
7
        T* dst = ptr + count;
329
7
        memmove(dst, ptr, (size() - p) * sizeof(T));
330
7
        _size += count;
331
7
        fill(item_ptr(p), count, value);
332
7
    }
333
334
    template <std::input_iterator InputIterator>
335
5.53M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
5.53M
        size_type p = pos - begin();
337
5.53M
        difference_type count = last - first;
338
5.53M
        size_type new_size = size() + count;
339
5.53M
        if (capacity() < new_size) {
340
374k
            change_capacity(new_size + (new_size >> 1));
341
374k
        }
342
5.53M
        T* ptr = item_ptr(p);
343
5.53M
        T* dst = ptr + count;
344
5.53M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
5.53M
        _size += count;
346
5.53M
        fill(ptr, first, last);
347
5.53M
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<unsigned char const*>(prevector<36u, unsigned char, unsigned int, int>::iterator, unsigned char const*, unsigned char const*)
Line
Count
Source
335
380
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
380
        size_type p = pos - begin();
337
380
        difference_type count = last - first;
338
380
        size_type new_size = size() + count;
339
380
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
380
        T* ptr = item_ptr(p);
343
380
        T* dst = ptr + count;
344
380
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
380
        _size += count;
346
380
        fill(ptr, first, last);
347
380
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>>(prevector<36u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>, __gnu_cxx::__normal_iterator<unsigned char const*, std::span<unsigned char const, 18446744073709551615ul>::__iter_tag>)
Line
Count
Source
335
2.72M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.72M
        size_type p = pos - begin();
337
2.72M
        difference_type count = last - first;
338
2.72M
        size_type new_size = size() + count;
339
2.72M
        if (capacity() < new_size) {
340
228k
            change_capacity(new_size + (new_size >> 1));
341
228k
        }
342
2.72M
        T* ptr = item_ptr(p);
343
2.72M
        T* dst = ptr + count;
344
2.72M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.72M
        _size += count;
346
2.72M
        fill(ptr, first, last);
347
2.72M
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
335
22.9k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
22.9k
        size_type p = pos - begin();
337
22.9k
        difference_type count = last - first;
338
22.9k
        size_type new_size = size() + count;
339
22.9k
        if (capacity() < new_size) {
340
17.2k
            change_capacity(new_size + (new_size >> 1));
341
17.2k
        }
342
22.9k
        T* ptr = item_ptr(p);
343
22.9k
        T* dst = ptr + count;
344
22.9k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
22.9k
        _size += count;
346
22.9k
        fill(ptr, first, last);
347
22.9k
    }
void prevector<8u, int, unsigned int, int>::insert<int*>(prevector<8u, int, unsigned int, int>::iterator, int*, int*)
Line
Count
Source
335
4.17k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
4.17k
        size_type p = pos - begin();
337
4.17k
        difference_type count = last - first;
338
4.17k
        size_type new_size = size() + count;
339
4.17k
        if (capacity() < new_size) {
340
322
            change_capacity(new_size + (new_size >> 1));
341
322
        }
342
4.17k
        T* ptr = item_ptr(p);
343
4.17k
        T* dst = ptr + count;
344
4.17k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
4.17k
        _size += count;
346
4.17k
        fill(ptr, first, last);
347
4.17k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>>(prevector<36u, unsigned char, unsigned int, int>::iterator, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char>>>)
Line
Count
Source
335
2.75k
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.75k
        size_type p = pos - begin();
337
2.75k
        difference_type count = last - first;
338
2.75k
        size_type new_size = size() + count;
339
2.75k
        if (capacity() < new_size) {
340
240
            change_capacity(new_size + (new_size >> 1));
341
240
        }
342
2.75k
        T* ptr = item_ptr(p);
343
2.75k
        T* dst = ptr + count;
344
2.75k
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.75k
        _size += count;
346
2.75k
        fill(ptr, first, last);
347
2.75k
    }
void prevector<36u, unsigned char, unsigned int, int>::insert<prevector<36u, unsigned char, unsigned int, int>::const_iterator>(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator, prevector<36u, unsigned char, unsigned int, int>::const_iterator)
Line
Count
Source
335
2.77M
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
2.77M
        size_type p = pos - begin();
337
2.77M
        difference_type count = last - first;
338
2.77M
        size_type new_size = size() + count;
339
2.77M
        if (capacity() < new_size) {
340
128k
            change_capacity(new_size + (new_size >> 1));
341
128k
        }
342
2.77M
        T* ptr = item_ptr(p);
343
2.77M
        T* dst = ptr + count;
344
2.77M
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
2.77M
        _size += count;
346
2.77M
        fill(ptr, first, last);
347
2.77M
    }
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
212
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
212
        size_type p = pos - begin();
337
212
        difference_type count = last - first;
338
212
        size_type new_size = size() + count;
339
212
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
212
        T* ptr = item_ptr(p);
343
212
        T* dst = ptr + count;
344
212
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
212
        _size += count;
346
212
        fill(ptr, first, last);
347
212
    }
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
212
    void insert(iterator pos, InputIterator first, InputIterator last) {
336
212
        size_type p = pos - begin();
337
212
        difference_type count = last - first;
338
212
        size_type new_size = size() + count;
339
212
        if (capacity() < new_size) {
340
0
            change_capacity(new_size + (new_size >> 1));
341
0
        }
342
212
        T* ptr = item_ptr(p);
343
212
        T* dst = ptr + count;
344
212
        memmove(dst, ptr, (size() - p) * sizeof(T));
345
212
        _size += count;
346
212
        fill(ptr, first, last);
347
212
    }
348
349
1.04M
    inline void resize_uninitialized(size_type new_size) {
350
        // resize_uninitialized changes the size of the prevector but does not initialize it.
351
        // If size < new_size, the added elements must be initialized explicitly.
352
1.04M
        if (capacity() < new_size) {
353
232k
            change_capacity(new_size);
354
232k
            _size += new_size - size();
355
232k
            return;
356
232k
        }
357
814k
        if (new_size < size()) {
358
3.32k
            erase(item_ptr(new_size), end());
359
811k
        } else {
360
811k
            _size += new_size - size();
361
811k
        }
362
814k
    }
prevector<36u, unsigned char, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
1.03M
    inline void resize_uninitialized(size_type new_size) {
350
        // resize_uninitialized changes the size of the prevector but does not initialize it.
351
        // If size < new_size, the added elements must be initialized explicitly.
352
1.03M
        if (capacity() < new_size) {
353
230k
            change_capacity(new_size);
354
230k
            _size += new_size - size();
355
230k
            return;
356
230k
        }
357
807k
        if (new_size < size()) {
358
0
            erase(item_ptr(new_size), end());
359
807k
        } else {
360
807k
            _size += new_size - size();
361
807k
        }
362
807k
    }
prevector<8u, int, unsigned int, int>::resize_uninitialized(unsigned int)
Line
Count
Source
349
8.43k
    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.43k
        if (capacity() < new_size) {
353
1.18k
            change_capacity(new_size);
354
1.18k
            _size += new_size - size();
355
1.18k
            return;
356
1.18k
        }
357
7.25k
        if (new_size < size()) {
358
3.32k
            erase(item_ptr(new_size), end());
359
3.92k
        } else {
360
3.92k
            _size += new_size - size();
361
3.92k
        }
362
7.25k
    }
363
364
27.8k
    iterator erase(iterator pos) {
365
27.8k
        return erase(pos, pos + 1);
366
27.8k
    }
367
368
13.8M
    iterator erase(iterator first, iterator last) {
369
        // Erase is not allowed to the change the object's capacity. That means
370
        // that when starting with an indirectly allocated prevector with
371
        // size and capacity > N, the result may be a still indirectly allocated
372
        // prevector with size <= N and capacity > N. A shrink_to_fit() call is
373
        // necessary to switch to the (more efficient) directly allocated
374
        // representation (with capacity N and size <= N).
375
13.8M
        iterator p = first;
376
13.8M
        char* endp = (char*)&(*end());
377
13.8M
        _size -= last - p;
378
13.8M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
13.8M
        return first;
380
13.8M
    }
prevector<36u, unsigned char, unsigned int, int>::erase(prevector<36u, unsigned char, unsigned int, int>::iterator, prevector<36u, unsigned char, unsigned int, int>::iterator)
Line
Count
Source
368
13.5M
    iterator erase(iterator first, iterator last) {
369
        // Erase is not allowed to the change the object's capacity. That means
370
        // that when starting with an indirectly allocated prevector with
371
        // size and capacity > N, the result may be a still indirectly allocated
372
        // prevector with size <= N and capacity > N. A shrink_to_fit() call is
373
        // necessary to switch to the (more efficient) directly allocated
374
        // representation (with capacity N and size <= N).
375
13.5M
        iterator p = first;
376
13.5M
        char* endp = (char*)&(*end());
377
13.5M
        _size -= last - p;
378
13.5M
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
13.5M
        return first;
380
13.5M
    }
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
146k
    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
146k
        iterator p = first;
376
146k
        char* endp = (char*)&(*end());
377
146k
        _size -= last - p;
378
146k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
146k
        return first;
380
146k
    }
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.6k
    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.6k
        iterator p = first;
376
70.6k
        char* endp = (char*)&(*end());
377
70.6k
        _size -= last - p;
378
70.6k
        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
379
70.6k
        return first;
380
70.6k
    }
Unexecuted instantiation: prevector<33u, unsigned char, unsigned int, int>::erase(prevector<33u, unsigned char, unsigned int, int>::iterator, prevector<33u, unsigned char, unsigned int, int>::iterator)
381
382
    template<typename... Args>
383
82.2k
    void emplace_back(Args&&... args) {
384
82.2k
        size_type new_size = size() + 1;
385
82.2k
        if (capacity() < new_size) {
386
13.3k
            change_capacity(new_size + (new_size >> 1));
387
13.3k
        }
388
82.2k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
82.2k
        _size++;
390
82.2k
    }
void prevector<36u, unsigned char, unsigned int, int>::emplace_back<unsigned char const&>(unsigned char const&)
Line
Count
Source
383
73.2k
    void emplace_back(Args&&... args) {
384
73.2k
        size_type new_size = size() + 1;
385
73.2k
        if (capacity() < new_size) {
386
13.0k
            change_capacity(new_size + (new_size >> 1));
387
13.0k
        }
388
73.2k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
73.2k
        _size++;
390
73.2k
    }
void prevector<8u, int, unsigned int, int>::emplace_back<int const&>(int const&)
Line
Count
Source
383
8.18k
    void emplace_back(Args&&... args) {
384
8.18k
        size_type new_size = size() + 1;
385
8.18k
        if (capacity() < new_size) {
386
228
            change_capacity(new_size + (new_size >> 1));
387
228
        }
388
8.18k
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
8.18k
        _size++;
390
8.18k
    }
void prevector<4u, Network, unsigned int, int>::emplace_back<Network const&>(Network const&)
Line
Count
Source
383
814
    void emplace_back(Args&&... args) {
384
814
        size_type new_size = size() + 1;
385
814
        if (capacity() < new_size) {
386
0
            change_capacity(new_size + (new_size >> 1));
387
0
        }
388
814
        new(item_ptr(size())) T(std::forward<Args>(args)...);
389
814
        _size++;
390
814
    }
391
392
82.2k
    void push_back(const T& value) {
393
82.2k
        emplace_back(value);
394
82.2k
    }
prevector<36u, unsigned char, unsigned int, int>::push_back(unsigned char const&)
Line
Count
Source
392
73.2k
    void push_back(const T& value) {
393
73.2k
        emplace_back(value);
394
73.2k
    }
prevector<8u, int, unsigned int, int>::push_back(int const&)
Line
Count
Source
392
8.18k
    void push_back(const T& value) {
393
8.18k
        emplace_back(value);
394
8.18k
    }
prevector<4u, Network, unsigned int, int>::push_back(Network const&)
Line
Count
Source
392
814
    void push_back(const T& value) {
393
814
        emplace_back(value);
394
814
    }
395
396
6.80k
    void pop_back() {
397
6.80k
        erase(end() - 1, end());
398
6.80k
    }
399
400
    T& front() {
401
        return *item_ptr(0);
402
    }
403
404
    const T& front() const {
405
        return *item_ptr(0);
406
    }
407
408
    T& back() {
409
        return *item_ptr(size() - 1);
410
    }
411
412
28.3k
    const T& back() const {
413
28.3k
        return *item_ptr(size() - 1);
414
28.3k
    }
415
416
    void swap(prevector<N, T, Size, Diff>& other) noexcept
417
16.4k
    {
418
16.4k
        std::swap(_union, other._union);
419
16.4k
        std::swap(_size, other._size);
420
16.4k
    }
421
422
160M
    ~prevector() {
423
160M
        if (!is_direct()) {
424
2.28M
            free(_union.indirect_contents.indirect);
425
2.28M
            _union.indirect_contents.indirect = nullptr;
426
2.28M
        }
427
160M
    }
prevector<16u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
1.49M
    ~prevector() {
423
1.49M
        if (!is_direct()) {
424
2.26k
            free(_union.indirect_contents.indirect);
425
2.26k
            _union.indirect_contents.indirect = nullptr;
426
2.26k
        }
427
1.49M
    }
prevector<36u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
157M
    ~prevector() {
423
157M
        if (!is_direct()) {
424
2.07M
            free(_union.indirect_contents.indirect);
425
2.07M
            _union.indirect_contents.indirect = nullptr;
426
2.07M
        }
427
157M
    }
prevector<33u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
620k
    ~prevector() {
423
620k
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
620k
    }
prevector<8u, int, unsigned int, int>::~prevector()
Line
Count
Source
422
536k
    ~prevector() {
423
536k
        if (!is_direct()) {
424
206k
            free(_union.indirect_contents.indirect);
425
206k
            _union.indirect_contents.indirect = nullptr;
426
206k
        }
427
536k
    }
prevector<4u, Network, unsigned int, int>::~prevector()
Line
Count
Source
422
406
    ~prevector() {
423
406
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
406
    }
prevector<35u, unsigned char, unsigned int, int>::~prevector()
Line
Count
Source
422
212
    ~prevector() {
423
212
        if (!is_direct()) {
424
0
            free(_union.indirect_contents.indirect);
425
0
            _union.indirect_contents.indirect = nullptr;
426
0
        }
427
212
    }
428
429
7.17M
    constexpr bool operator==(const prevector& other) const {
430
7.17M
        return std::ranges::equal(*this, other);
431
7.17M
    }
prevector<36u, unsigned char, unsigned int, int>::operator==(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
6.41M
    constexpr bool operator==(const prevector& other) const {
430
6.41M
        return std::ranges::equal(*this, other);
431
6.41M
    }
prevector<8u, int, unsigned int, int>::operator==(prevector<8u, int, unsigned int, int> const&) const
Line
Count
Source
429
536k
    constexpr bool operator==(const prevector& other) const {
430
536k
        return std::ranges::equal(*this, other);
431
536k
    }
prevector<16u, unsigned char, unsigned int, int>::operator==(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
429
220k
    constexpr bool operator==(const prevector& other) const {
430
220k
        return std::ranges::equal(*this, other);
431
220k
    }
432
433
21.4M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.4M
        if (size() < other.size()) {
435
930k
            return true;
436
930k
        }
437
20.5M
        if (size() > other.size()) {
438
330k
            return false;
439
330k
        }
440
20.1M
        const_iterator b1 = begin();
441
20.1M
        const_iterator b2 = other.begin();
442
20.1M
        const_iterator e1 = end();
443
126M
        while (b1 != e1) {
444
124M
            if ((*b1) < (*b2)) {
445
10.1M
                return true;
446
10.1M
            }
447
114M
            if ((*b2) < (*b1)) {
448
7.53M
                return false;
449
7.53M
            }
450
106M
            ++b1;
451
106M
            ++b2;
452
106M
        }
453
2.46M
        return false;
454
20.1M
    }
prevector<36u, unsigned char, unsigned int, int>::operator<(prevector<36u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
21.4M
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
21.4M
        if (size() < other.size()) {
435
930k
            return true;
436
930k
        }
437
20.4M
        if (size() > other.size()) {
438
330k
            return false;
439
330k
        }
440
20.1M
        const_iterator b1 = begin();
441
20.1M
        const_iterator b2 = other.begin();
442
20.1M
        const_iterator e1 = end();
443
126M
        while (b1 != e1) {
444
124M
            if ((*b1) < (*b2)) {
445
10.1M
                return true;
446
10.1M
            }
447
114M
            if ((*b2) < (*b1)) {
448
7.53M
                return false;
449
7.53M
            }
450
106M
            ++b1;
451
106M
            ++b2;
452
106M
        }
453
2.44M
        return false;
454
20.1M
    }
prevector<16u, unsigned char, unsigned int, int>::operator<(prevector<16u, unsigned char, unsigned int, int> const&) const
Line
Count
Source
433
28.7k
    bool operator<(const prevector<N, T, Size, Diff>& other) const {
434
28.7k
        if (size() < other.size()) {
435
0
            return true;
436
0
        }
437
28.7k
        if (size() > other.size()) {
438
0
            return false;
439
0
        }
440
28.7k
        const_iterator b1 = begin();
441
28.7k
        const_iterator b2 = other.begin();
442
28.7k
        const_iterator e1 = end();
443
144k
        while (b1 != e1) {
444
115k
            if ((*b1) < (*b2)) {
445
329
                return true;
446
329
            }
447
115k
            if ((*b2) < (*b1)) {
448
129
                return false;
449
129
            }
450
115k
            ++b1;
451
115k
            ++b2;
452
115k
        }
453
28.2k
        return false;
454
28.7k
    }
455
456
52.0M
    size_t allocated_memory() const {
457
52.0M
        if (is_direct()) {
458
51.2M
            return 0;
459
51.2M
        } else {
460
855k
            return ((size_t)(sizeof(T))) * _union.indirect_contents.capacity;
461
855k
        }
462
52.0M
    }
463
464
595k
    value_type* data() {
465
595k
        return item_ptr(0);
466
595k
    }
prevector<16u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
42.0k
    value_type* data() {
465
42.0k
        return item_ptr(0);
466
42.0k
    }
prevector<33u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
246k
    value_type* data() {
465
246k
        return item_ptr(0);
466
246k
    }
prevector<36u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
306k
    value_type* data() {
465
306k
        return item_ptr(0);
466
306k
    }
prevector<35u, unsigned char, unsigned int, int>::data()
Line
Count
Source
464
212
    value_type* data() {
465
212
        return item_ptr(0);
466
212
    }
467
468
34.8M
    const value_type* data() const {
469
34.8M
        return item_ptr(0);
470
34.8M
    }
prevector<36u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
32.5M
    const value_type* data() const {
469
32.5M
        return item_ptr(0);
470
32.5M
    }
prevector<16u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
2.22M
    const value_type* data() const {
469
2.22M
        return item_ptr(0);
470
2.22M
    }
prevector<33u, unsigned char, unsigned int, int>::data() const
Line
Count
Source
468
119k
    const value_type* data() const {
469
119k
        return item_ptr(0);
470
119k
    }
471
};
472
473
#endif // BITCOIN_PREVECTOR_H