• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

realm / realm-core / jorgen.edelbo_389

12 Aug 2024 02:13PM UTC coverage: 91.085% (-0.02%) from 91.107%
jorgen.edelbo_389

Pull #7826

Evergreen

jedelbo
Bump file format version
Pull Request #7826: Merge Next major

103458 of 182206 branches covered (56.78%)

3138 of 3500 new or added lines in 53 files covered. (89.66%)

175 existing lines in 17 files now uncovered.

219944 of 241471 relevant lines covered (91.09%)

6840929.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.81
/src/realm/array.hpp
1
/*************************************************************************
2
 *
3
 * Copyright 2016 Realm Inc.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 **************************************************************************/
18

19
#ifndef REALM_ARRAY_HPP
20
#define REALM_ARRAY_HPP
21

22
#include <realm/node.hpp>
23
#include <realm/query_state.hpp>
24
#include <realm/query_conditions.hpp>
25
#include <realm/column_fwd.hpp>
26
#include <realm/array_direct.hpp>
27
#include <realm/integer_compressor.hpp>
28

29
namespace realm {
30

31
// Pre-definitions
32
class GroupWriter;
33
namespace _impl {
34
class ArrayWriterBase;
35
}
36

37
struct MemStats {
38
    size_t allocated = 0;
39
    size_t used = 0;
40
    size_t array_count = 0;
41
};
42

43
// Stores a value obtained from Array::get(). It is a ref if the least
44
// significant bit is clear, otherwise it is a tagged integer. A tagged interger
45
// is obtained from a logical integer value by left shifting by one bit position
46
// (multiplying by two), and then setting the least significant bit to
47
// one. Clearly, this means that the maximum value that can be stored as a
48
// tagged integer is 2**63 - 1.
49
class RefOrTagged {
50
public:
51
    bool is_ref() const noexcept;
52
    bool is_tagged() const noexcept;
53
    ref_type get_as_ref() const noexcept;
54
    uint_fast64_t get_as_int() const noexcept;
55

56
    static RefOrTagged make_ref(ref_type) noexcept;
57
    static RefOrTagged make_tagged(uint_fast64_t) noexcept;
58

59
private:
60
    int_fast64_t m_value;
61
    RefOrTagged(int_fast64_t) noexcept;
62
    friend class Array;
63
};
64

65

66
template <class T>
67
class QueryStateFindAll : public QueryStateBase {
68
public:
69
    explicit QueryStateFindAll(T& keys, size_t limit = -1)
70
        : QueryStateBase(limit)
773,736✔
71
        , m_keys(keys)
773,736✔
72
    {
1,593,744✔
73
    }
1,593,744✔
74
    bool match(size_t index, Mixed) noexcept final;
75
    bool match(size_t index) noexcept final;
76

77
private:
78
    T& m_keys;
79
};
80

81
class QueryStateFindFirst : public QueryStateBase {
82
public:
83
    size_t m_state = realm::not_found;
84
    QueryStateFindFirst()
85
        : QueryStateBase(1)
5,829,966✔
86
    {
11,591,658✔
87
    }
11,591,658✔
88
    bool match(size_t index, Mixed) noexcept final;
89
    bool match(size_t index) noexcept final;
90
};
91

92
class Array : public Node, public ArrayParent {
93
public:
94
    /// Create an array accessor in the unattached state.
95
    explicit Array(Allocator& allocator) noexcept;
96
    virtual ~Array() noexcept = default;
852,463,200✔
97

98
    /// Create a new integer array of the specified type and size, and filled
99
    /// with the specified value, and attach this accessor to it. This does not
100
    /// modify the parent reference information of this accessor.
101
    ///
102
    /// Note that the caller assumes ownership of the allocated underlying
103
    /// node. It is not owned by the accessor.
104
    void create(Type, bool context_flag = false, size_t size = 0, int_fast64_t value = 0);
105

106
    /// Reinitialize this array accessor to point to the specified new
107
    /// underlying memory. This does not modify the parent reference information
108
    /// of this accessor.
109
    void init_from_ref(ref_type ref) noexcept
110
    {
233,285,721✔
111
        REALM_ASSERT_DEBUG(ref);
233,285,721✔
112
        char* header = m_alloc.translate(ref);
233,285,721✔
113
        init_from_mem(MemRef(header, ref, m_alloc));
233,285,721✔
114
    }
233,285,721✔
115

116
    /// Same as init_from_ref(ref_type) but avoid the mapping of 'ref' to memory
117
    /// pointer.
118
    void init_from_mem(MemRef) noexcept;
119

120
    /// Same as `init_from_ref(get_ref_from_parent())`.
121
    void init_from_parent() noexcept
122
    {
93,694,176✔
123
        ref_type ref = get_ref_from_parent();
93,694,176✔
124
        init_from_ref(ref);
93,694,176✔
125
    }
93,694,176✔
126

127
    MemRef get_mem() const noexcept;
128

129
    /// Called in the context of Group::commit() to ensure that attached
130
    /// accessors stay valid across a commit. Please note that this works only
131
    /// for non-transactional commits. Accessors obtained during a transaction
132
    /// are always detached when the transaction ends.
133
    void update_from_parent() noexcept;
134

135
    /// Change the type of an already attached array node.
136
    ///
137
    /// The effect of calling this function on an unattached accessor is
138
    /// undefined.
139
    void set_type(Type);
140

141
    /// Construct an empty integer array of the specified type, and return just
142
    /// the reference to the underlying memory.
143
    static MemRef create_empty_array(Type, bool context_flag, Allocator&);
144

145
    /// Construct an integer array of the specified type and size, and return
146
    /// just the reference to the underlying memory. All elements will be
147
    /// initialized to the specified value.
148
    static MemRef create_array(Type, bool context_flag, size_t size, int_fast64_t value, Allocator&);
149

150
    Type get_type() const noexcept;
151

152
    /// The meaning of 'width' depends on the context in which this
153
    /// array is used.
154
    size_t get_width() const noexcept
155
    {
3,354,564✔
156
        REALM_ASSERT_3(m_width, ==, get_width_from_header(get_header()));
3,354,564✔
157
        return m_width;
3,354,564✔
158
    }
3,354,564✔
159

160
    void insert(size_t ndx, int_fast64_t value);
161
    void add(int_fast64_t value);
162

163
    // Used from ArrayBlob
164
    size_t blob_size() const noexcept;
165
    ref_type blob_replace(size_t begin, size_t end, const char* data, size_t data_size, bool add_zero_term);
166

167
    /// This function is guaranteed to not throw if the current width is
168
    /// sufficient for the specified value (e.g. if you have called
169
    /// ensure_minimum_width(value)) and get_alloc().is_read_only(get_ref())
170
    /// returns false (noexcept:array-set). Note that for a value of zero, the
171
    /// first criterion is trivially satisfied.
172
    void set(size_t ndx, int64_t value);
173

174
    void set_as_ref(size_t ndx, ref_type ref);
175

176
    template <size_t w>
177
    static void set(Array&, size_t ndx, int64_t value);
178

179
    int64_t get(size_t ndx) const noexcept;
180

181
    std::vector<int64_t> get_all(size_t b, size_t e) const;
182

183
    template <size_t w>
184
    static int64_t get(const Array& arr, size_t ndx) noexcept;
185

186
    void get_chunk(size_t ndx, int64_t res[8]) const noexcept;
187

188
    template <size_t w>
189
    static void get_chunk(const Array&, size_t ndx, int64_t res[8]) noexcept;
190

191
    ref_type get_as_ref(size_t ndx) const noexcept;
192
    RefOrTagged get_as_ref_or_tagged(size_t ndx) const noexcept;
193

194
    void set(size_t ndx, RefOrTagged);
195
    void add(RefOrTagged);
196
    void ensure_minimum_width(RefOrTagged);
197

198
    int64_t front() const noexcept;
199
    int64_t back() const noexcept;
200

201
    void alloc(size_t init_size, size_t new_width)
202
    {
973,230,093✔
203
        // Node::alloc is the one that triggers copy on write. If we call alloc for a B
204
        //       array we have a bug in our machinery, the array should have been decompressed
205
        //       way before calling alloc.
206
        const auto header = get_header();
973,230,093✔
207
        REALM_ASSERT_3(m_width, ==, get_width_from_header(header));
973,230,093✔
208
        REALM_ASSERT_3(m_size, ==, get_size_from_header(header));
973,230,093✔
209
        Node::alloc(init_size, new_width);
973,230,093✔
210
        update_width_cache_from_header();
973,230,093✔
211
    }
973,230,093✔
212

213
    bool is_empty() const noexcept
214
    {
66,111✔
215
        return size() == 0;
66,111✔
216
    }
66,111✔
217

218
    /// Remove the element at the specified index, and move elements at higher
219
    /// indexes to the next lower index.
220
    ///
221
    /// This function does **not** destroy removed subarrays. That is, if the
222
    /// erased element is a 'ref' pointing to a subarray, then that subarray
223
    /// will not be destroyed automatically.
224
    ///
225
    /// This function guarantees that no exceptions will be thrown if
226
    /// get_alloc().is_read_only(get_ref()) would return false before the
227
    /// call. This is automatically guaranteed if the array is used in a
228
    /// non-transactional context, or if the array has already been successfully
229
    /// modified within the current write transaction.
230
    void erase(size_t ndx);
231

232
    /// Same as erase(size_t), but remove all elements in the specified
233
    /// range.
234
    ///
235
    /// Please note that this function does **not** destroy removed subarrays.
236
    ///
237
    /// This function guarantees that no exceptions will be thrown if
238
    /// get_alloc().is_read_only(get_ref()) would return false before the call.
239
    void erase(size_t begin, size_t end);
240

241
    /// Reduce the size of this array to the specified number of elements. It is
242
    /// an error to specify a size that is greater than the current size of this
243
    /// array. The effect of doing so is undefined. This is just a shorthand for
244
    /// calling the ranged erase() function with appropriate arguments.
245
    ///
246
    /// Please note that this function does **not** destroy removed
247
    /// subarrays. See clear_and_destroy_children() for an alternative.
248
    ///
249
    /// This function guarantees that no exceptions will be thrown if
250
    /// get_alloc().is_read_only(get_ref()) would return false before the call.
251
    void truncate(size_t new_size);
252

253
    /// Reduce the size of this array to the specified number of elements. It is
254
    /// an error to specify a size that is greater than the current size of this
255
    /// array. The effect of doing so is undefined. Subarrays will be destroyed
256
    /// recursively, as if by a call to `destroy_deep(subarray_ref, alloc)`.
257
    ///
258
    /// This function is guaranteed not to throw if
259
    /// get_alloc().is_read_only(get_ref()) returns false.
260
    void truncate_and_destroy_children(size_t new_size);
261

262
    /// Remove every element from this array. This is just a shorthand for
263
    /// calling truncate(0).
264
    ///
265
    /// Please note that this function does **not** destroy removed
266
    /// subarrays. See clear_and_destroy_children() for an alternative.
267
    ///
268
    /// This function guarantees that no exceptions will be thrown if
269
    /// get_alloc().is_read_only(get_ref()) would return false before the call.
270
    void clear();
271

272
    /// Remove every element in this array. Subarrays will be destroyed
273
    /// recursively, as if by a call to `destroy_deep(subarray_ref,
274
    /// alloc)`. This is just a shorthand for calling
275
    /// truncate_and_destroy_children(0).
276
    ///
277
    /// This function guarantees that no exceptions will be thrown if
278
    /// get_alloc().is_read_only(get_ref()) would return false before the call.
279
    void clear_and_destroy_children();
280

281
    /// If neccessary, expand the representation so that it can store the
282
    /// specified value.
283
    void ensure_minimum_width(int_fast64_t value);
284

285
    /// Add \a diff to the element at the specified index.
286
    void adjust(size_t ndx, int_fast64_t diff);
287

288
    /// Add \a diff to all the elements in the specified index range.
289
    void adjust(size_t begin, size_t end, int_fast64_t diff);
290

291
    //@{
292
    /// This is similar in spirit to std::move() from `<algorithm>`.
293
    /// \a dest_begin must not be in the range [`begin`,`end`)
294
    ///
295
    /// This function is guaranteed to not throw if
296
    /// `get_alloc().is_read_only(get_ref())` returns false.
297
    void move(size_t begin, size_t end, size_t dest_begin);
298
    //@}
299

300
    // Move elements from ndx and above to another array
301
    void move(Array& dst, size_t ndx);
302

303
    //@{
304
    /// Find the lower/upper bound of the specified value in a sequence of
305
    /// integers which must already be sorted ascendingly.
306
    ///
307
    /// For an integer value '`v`', lower_bound_int(v) returns the index '`l`'
308
    /// of the first element such that `get(l) &ge; v`, and upper_bound_int(v)
309
    /// returns the index '`u`' of the first element such that `get(u) &gt;
310
    /// v`. In both cases, if no such element is found, the returned value is
311
    /// the number of elements in the array.
312
    ///
313
    ///     3 3 3 4 4 4 5 6 7 9 9 9
314
    ///     ^     ^     ^     ^     ^
315
    ///     |     |     |     |     |
316
    ///     |     |     |     |      -- Lower and upper bound of 15
317
    ///     |     |     |     |
318
    ///     |     |     |      -- Lower and upper bound of 8
319
    ///     |     |     |
320
    ///     |     |      -- Upper bound of 4
321
    ///     |     |
322
    ///     |      -- Lower bound of 4
323
    ///     |
324
    ///      -- Lower and upper bound of 1
325
    ///
326
    /// These functions are similar to std::lower_bound() and
327
    /// std::upper_bound().
328
    ///
329
    /// We currently use binary search. See for example
330
    /// http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary.
331
    ///
332
    /// FIXME: It may be worth considering if overall efficiency can be improved
333
    /// by doing a linear search for short sequences.
334
    size_t lower_bound_int(int64_t value) const noexcept;
335
    size_t upper_bound_int(int64_t value) const noexcept;
336
    size_t lower_bound_int_compressed(int64_t value) const noexcept;
337
    size_t upper_bound_int_compressed(int64_t value) const noexcept;
338
    //@}
339

340
    int64_t get_sum(size_t start = 0, size_t end = size_t(-1)) const
341
    {
24,708✔
342
        return sum(start, end);
24,708✔
343
    }
24,708✔
344

345
    /// This information is guaranteed to be cached in the array accessor.
346
    bool is_inner_bptree_node() const noexcept;
347

348
    /// Returns true if type is either type_HasRefs or type_InnerColumnNode.
349
    ///
350
    /// This information is guaranteed to be cached in the array accessor.
351
    bool has_refs() const noexcept;
352
    void set_has_refs(bool) noexcept;
353

354
    /// This information is guaranteed to be cached in the array accessor.
355
    ///
356
    /// Columns and indexes can use the context bit to differentiate leaf types.
357
    bool get_context_flag() const noexcept;
358
    void set_context_flag(bool) noexcept;
359

360
    /// Recursively destroy children (as if calling
361
    /// clear_and_destroy_children()), then put this accessor into the detached
362
    /// state (as if calling detach()), then free the allocated memory. If this
363
    /// accessor is already in the detached state, this function has no effect
364
    /// (idempotency).
365
    void destroy_deep() noexcept;
366

367
    /// check if the array is encoded (in B format)
368
    inline bool is_compressed() const;
369

370
    inline const IntegerCompressor& integer_compressor() const;
371

372
    /// used only for testing, encode the array passed as argument
373
    bool try_compress(Array&) const;
374

375
    /// used only for testing, decode the array, on which this method is invoked. If the array is not encoded, this is
376
    /// a NOP
377
    bool try_decompress();
378

379
    /// Shorthand for `destroy_deep(MemRef(ref, alloc), alloc)`.
380
    static void destroy_deep(ref_type ref, Allocator& alloc) noexcept;
381

382
    /// Destroy the specified array node and all of its children, recursively.
383
    ///
384
    /// This is done by freeing the specified array node after calling
385
    /// destroy_deep() for every contained 'ref' element.
386
    static void destroy_deep(MemRef, Allocator&) noexcept;
387

388
    // Clone deep
389
    static MemRef clone(MemRef, Allocator& from_alloc, Allocator& target_alloc);
390

391
    // Serialization
392

393
    /// Returns the ref (position in the target stream) of the written copy of
394
    /// this array, or the ref of the original array if \a only_if_modified is
395
    /// true, and this array is unmodified (Alloc::is_read_only()).
396
    ///
397
    /// The number of bytes that will be written by a non-recursive invocation
398
    /// of this function is exactly the number returned by get_byte_size().
399
    ///
400
    /// \param out The destination stream (writer).
401
    ///
402
    /// \param deep If true, recursively write out subarrays, but still subject
403
    /// to \a only_if_modified.
404
    ///
405
    /// \param only_if_modified Set to `false` to always write, or to `true` to
406
    /// only write the array if it has been modified.
407
    ref_type write(_impl::ArrayWriterBase& out, bool deep, bool only_if_modified, bool compress_in_flight) const;
408

409
    /// Same as non-static write() with `deep` set to true. This is for the
410
    /// cases where you do not already have an array accessor available.
411
    /// Compression may be attempted if `compress_in_flight` is true.
412
    /// This should be avoided if you rely on the size of the array beeing unchanged.
413
    static ref_type write(ref_type, Allocator&, _impl::ArrayWriterBase&, bool only_if_modified,
414
                          bool compress_in_flight);
415

416
    inline size_t find_first(int64_t value, size_t begin = 0, size_t end = size_t(-1)) const
417
    {
8,817,018✔
418
        return find_first<Equal>(value, begin, end);
8,817,018✔
419
    }
8,817,018✔
420

421
    // Wrappers for backwards compatibility and for simple use without
422
    // setting up state initialization etc
423
    template <class cond>
424
    size_t find_first(int64_t value, size_t start = 0, size_t end = size_t(-1)) const
425
    {
12,385,332✔
426
        static cond c;
12,385,332✔
427
        REALM_ASSERT(start <= m_size && (end <= m_size || end == size_t(-1)) && start <= end);
12,385,332✔
428
        if (end - start == 1) {
12,385,332✔
429
            return c(get(start), value) ? start : realm::not_found;
1,531,098✔
430
        }
1,531,098✔
431
        // todo, would be nice to avoid this in order to speed up find_first loops
432
        QueryStateFindFirst state;
10,854,234✔
433
        Finder finder = m_vtable->finder[cond::condition];
10,854,234✔
434
        finder(*this, value, start, end, 0, &state);
10,854,234✔
435
        return state.m_state;
10,854,234✔
436
    }
12,385,332✔
437

438
    template <class cond>
439
    bool find(int64_t value, size_t start, size_t end, size_t baseIndex, QueryStateBase* state) const
440
    {
6,967,227✔
441
        Finder finder = m_vtable->finder[cond::condition];
6,967,227✔
442
        return finder(*this, value, start, end, baseIndex, state);
6,967,227✔
443
    }
6,967,227✔
444

445

446
    /// Get the specified element without the cost of constructing an
447
    /// array instance. If an array instance is already available, or
448
    /// you need to get multiple values, then this method will be
449
    /// slower.
450
    static int_fast64_t get(const char* header, size_t ndx) noexcept;
451

452
    /// Like get(const char*, size_t) but gets two consecutive
453
    /// elements.
454
    static std::pair<int64_t, int64_t> get_two(const char* header, size_t ndx) noexcept;
455

456
    static RefOrTagged get_as_ref_or_tagged(const char* header, size_t ndx) noexcept
457
    {
72,702,261✔
458
        return get(header, ndx);
72,702,261✔
459
    }
72,702,261✔
460

461
    /// Get the number of bytes currently in use by this array. This
462
    /// includes the array header, but it does not include allocated
463
    /// bytes corresponding to excess capacity. The result is
464
    /// guaranteed to be a multiple of 8 (i.e., 64-bit aligned).
465
    ///
466
    /// This number is exactly the number of bytes that will be
467
    /// written by a non-recursive invocation of write().
468
    size_t get_byte_size() const noexcept;
469

470
    // Get the number of bytes used by this array and its sub-arrays
471
    size_t get_byte_size_deep() const noexcept
472
    {
156✔
473
        size_t mem = 0;
156✔
474
        _mem_usage(mem);
156✔
475
        return mem;
156✔
476
    }
156✔
477

478

479
    /// Get the maximum number of bytes that can be written by a
480
    /// non-recursive invocation of write() on an array with the
481
    /// specified number of elements, that is, the maximum value that
482
    /// can be returned by get_byte_size().
483
    static size_t get_max_byte_size(size_t num_elems) noexcept;
484

485
    /// FIXME: Belongs in IntegerArray
486
    static size_t calc_aligned_byte_size(size_t size, int width);
487

488
#ifdef REALM_DEBUG
489
    class MemUsageHandler {
490
    public:
491
        virtual void handle(ref_type ref, size_t allocated, size_t used) = 0;
492
    };
493

494
    void report_memory_usage(MemUsageHandler&) const;
495

496
    void stats(MemStats& stats_dest) const noexcept;
497
#endif
498

499
    void verify() const;
500

501
    Array& operator=(const Array&) = delete; // not allowed
502
    Array(const Array&) = delete;            // not allowed
503

504
    /// Takes a 64-bit value and returns the minimum number of bits needed
505
    /// to fit the value. For alignment this is rounded up to nearest
506
    /// log2. Possible results {0, 1, 2, 4, 8, 16, 32, 64}
507
    static uint8_t bit_width(int64_t value);
508

509
protected:
510
    friend class NodeTree;
511
    void copy_on_write();
512
    void copy_on_write(size_t min_size);
513

514
    // This returns the minimum value ("lower bound") of the representable values
515
    // for the given bit width. Valid widths are 0, 1, 2, 4, 8, 16, 32, and 64.
516
    static constexpr int_fast64_t lbound_for_width(size_t width) noexcept;
517

518
    // This returns the maximum value ("inclusive upper bound") of the representable values
519
    // for the given bit width. Valid widths are 0, 1, 2, 4, 8, 16, 32, and 64.
520
    static constexpr int_fast64_t ubound_for_width(size_t width) noexcept;
521

522
    // This will have to be eventually used, exposing this here for testing.
523
    size_t count(int64_t value) const noexcept;
524

525
private:
526
    void update_width_cache_from_header() noexcept;
527

528
    void do_ensure_minimum_width(int_fast64_t);
529

530
    int64_t sum(size_t start, size_t end) const;
531

532
    template <size_t w>
533
    int64_t sum(size_t start, size_t end) const;
534

535
protected:
536
    /// It is an error to specify a non-zero value unless the width
537
    /// type is wtype_Bits. It is also an error to specify a non-zero
538
    /// size if the width type is wtype_Ignore.
539
    static MemRef create(Type, bool, WidthType, size_t, int_fast64_t, Allocator&);
540

541
    // Overriding method in ArrayParent
542
    void update_child_ref(size_t, ref_type) override;
543

544
    // Overriding method in ArrayParent
545
    ref_type get_child_ref(size_t) const noexcept override;
546

547
    void destroy_children(size_t offset = 0) noexcept;
548

549
protected:
550
    // Getters and Setters for adaptive-packed arrays
551
    typedef int64_t (*Getter)(const Array&, size_t); // Note: getters must not throw
552
    typedef void (*Setter)(Array&, size_t, int64_t);
553
    typedef bool (*Finder)(const Array&, int64_t, size_t, size_t, size_t, QueryStateBase*);
554
    typedef void (*ChunkGetter)(const Array&, size_t, int64_t res[8]); // Note: getters must not throw
555

556
    typedef std::vector<int64_t> (*GetterAll)(const Array&, size_t, size_t); // Note: getters must not throw
557

558
    struct VTable {
559
        Getter getter;
560
        ChunkGetter chunk_getter;
561
        GetterAll getter_all;
562
        Setter setter;
563
        Finder finder[cond_VTABLE_FINDER_COUNT]; // one for each active function pointer
564
    };
565
    template <size_t w>
566
    struct VTableForWidth;
567

568
    // This is the one installed into the m_vtable->finder slots.
569
    template <class cond>
570
    static bool find_vtable(const Array&, int64_t value, size_t start, size_t end, size_t baseindex,
571
                            QueryStateBase* state);
572

573
    template <size_t w>
574
    static int64_t get_universal(const char* const data, const size_t ndx);
575

576
protected:
577
    Getter m_getter = nullptr; // cached to avoid indirection
578
    const VTable* m_vtable = nullptr;
579

580
    uint_least8_t m_width = 0; // Size of an element (meaning depend on type of array).
581
    int64_t m_lbound;          // min number that can be stored with current m_width
582
    int64_t m_ubound;          // max number that can be stored with current m_width
583

584
    bool m_is_inner_bptree_node; // This array is an inner node of B+-tree.
585
    bool m_has_refs;             // Elements whose first bit is zero are refs to subarrays.
586
    bool m_context_flag;         // Meaning depends on context.
587

588
    IntegerCompressor m_integer_compressor;
589
    // compress/decompress this array
590
    bool compress_array(Array&) const;
591
    bool decompress_array(Array& arr) const;
592

593
private:
594
    ref_type do_write_shallow(_impl::ArrayWriterBase&) const;
595
    ref_type do_write_deep(_impl::ArrayWriterBase&, bool only_if_modified, bool compress) const;
596

597
    void _mem_usage(size_t& mem) const noexcept;
598

599
#ifdef REALM_DEBUG
600
    void report_memory_usage_2(MemUsageHandler&) const;
601
#endif
602

603

604
private:
605
    friend class Allocator;
606
    friend class SlabAlloc;
607
    friend class GroupWriter;
608
    friend class ArrayWithFind;
609
    friend class IntegerCompressor;
610
    friend class PackedCompressor;
611
    friend class FlexCompressor;
612
};
613

614
class TempArray : public Array {
615
public:
616
    TempArray(size_t sz, Type type = Type::type_HasRefs, bool cf = false)
617
        : Array(Allocator::get_default())
1,534,239✔
618
    {
3,073,356✔
619
        create(type, cf, sz);
3,073,356✔
620
    }
3,073,356✔
621
    ~TempArray()
622
    {
3,073,608✔
623
        destroy();
3,073,608✔
624
    }
3,073,608✔
625
    ref_type write(_impl::ArrayWriterBase& out)
626
    {
3,073,527✔
627
        return Array::write(out, false, false, false);
3,073,527✔
628
    }
3,073,527✔
629
};
630

631
// Implementation:
632

633
inline Array::Array(Allocator& allocator) noexcept
634
    : Node(allocator)
458,101,833✔
635
{
927,068,427✔
636
}
927,068,427✔
637

638
inline bool Array::is_compressed() const
639
{
994,967,610✔
640
    const auto enc = m_integer_compressor.get_encoding();
994,967,610✔
641
    return enc == NodeHeader::Encoding::Flex || enc == NodeHeader::Encoding::Packed;
995,232,777✔
642
}
994,967,610✔
643

644
inline const IntegerCompressor& Array::integer_compressor() const
645
{
4,043,472✔
646
    return m_integer_compressor;
4,043,472✔
647
}
4,043,472✔
648

649
inline int64_t Array::get(size_t ndx) const noexcept
650
{
2,726,625,066✔
651
    REALM_ASSERT_DEBUG(is_attached());
2,726,625,066✔
652
    REALM_ASSERT_DEBUG_EX(ndx < m_size, ndx, m_size);
2,726,625,066✔
653
    return m_getter(*this, ndx);
2,726,625,066✔
654

655
    // Two ideas that are not efficient but may be worth looking into again:
656
    /*
657
        // Assume correct width is found early in REALM_TEMPEX, which is the case for B tree offsets that
658
        // are probably either 2^16 long. Turns out to be 25% faster if found immediately, but 50-300% slower
659
        // if found later
660
        REALM_TEMPEX(return get, (ndx));
661
    */
662
    /*
663
        // Slightly slower in both of the if-cases. Also needs an matchcount m_size check too, to avoid
664
        // reading beyond array.
665
        if (m_width >= 8 && m_size > ndx + 7)
666
            return get<64>(ndx >> m_shift) & m_widthmask;
667
        else
668
            return (this->*(m_vtable->getter))(ndx);
669
    */
670
}
2,726,625,066✔
671

672
inline std::vector<int64_t> Array::get_all(size_t b, size_t e) const
673
{
2✔
674
    REALM_ASSERT_DEBUG(is_compressed());
2✔
675
    return m_vtable->getter_all(*this, b, e);
2✔
676
}
2✔
677

678
template <size_t w>
679
inline int64_t Array::get(const Array& arr, size_t ndx) noexcept
680
{
3,787,518,931✔
681
    REALM_ASSERT_DEBUG(arr.is_attached());
3,787,518,931✔
682
    return get_universal<w>(arr.m_data, ndx);
3,787,518,931✔
683
}
3,787,518,931✔
684

685
constexpr inline int_fast64_t Array::lbound_for_width(size_t width) noexcept
686
{
1,681,370,841✔
687
    if (width == 32) {
1,681,370,841✔
688
        return -0x80000000LL;
686,618,115✔
689
    }
686,618,115✔
690
    else if (width == 16) {
994,752,726✔
691
        return -0x8000LL;
345,338,625✔
692
    }
345,338,625✔
693
    else if (width < 8) {
649,414,101✔
694
        return 0;
410,690,928✔
695
    }
410,690,928✔
696
    else if (width == 8) {
238,723,173✔
697
        return -0x80LL;
155,504,448✔
698
    }
155,504,448✔
699
    else if (width == 64) {
239,230,341✔
700
        return -0x8000000000000000LL;
239,230,341✔
701
    }
239,230,341✔
702
    else {
4,294,967,294✔
703
        REALM_UNREACHABLE();
704
    }
4,294,967,294✔
705
}
1,681,370,841✔
706

707
constexpr inline int_fast64_t Array::ubound_for_width(size_t width) noexcept
708
{
1,687,239,081✔
709
    if (width == 32) {
1,687,239,081✔
710
        return 0x7FFFFFFFLL;
687,703,569✔
711
    }
687,703,569✔
712
    else if (width == 16) {
999,535,512✔
713
        return 0x7FFFLL;
346,992,669✔
714
    }
346,992,669✔
715
    else if (width == 0) {
652,542,843✔
716
        return 0;
66,643,452✔
717
    }
66,643,452✔
718
    else if (width == 1) {
585,899,391✔
719
        return 1;
181,770,369✔
720
    }
181,770,369✔
721
    else if (width == 2) {
404,129,022✔
722
        return 3;
151,772,205✔
723
    }
151,772,205✔
724
    else if (width == 4) {
252,356,817✔
725
        return 15;
18,459,903✔
726
    }
18,459,903✔
727
    else if (width == 8) {
233,896,914✔
728
        return 0x7FLL;
155,534,391✔
729
    }
155,534,391✔
730
    else if (width == 64) {
239,636,193✔
731
        return 0x7FFFFFFFFFFFFFFFLL;
239,636,193✔
732
    }
239,636,193✔
733
    else {
4,294,967,294✔
734
        REALM_UNREACHABLE();
735
    }
4,294,967,294✔
736
}
1,687,239,081✔
737

738
inline bool RefOrTagged::is_ref() const noexcept
739
{
501,767,988✔
740
    return (m_value & 1) == 0;
501,767,988✔
741
}
501,767,988✔
742

743
inline bool RefOrTagged::is_tagged() const noexcept
744
{
430,780,605✔
745
    return !is_ref();
430,780,605✔
746
}
430,780,605✔
747

748
inline ref_type RefOrTagged::get_as_ref() const noexcept
749
{
102,458,805✔
750
    // to_ref() is defined in <alloc.hpp>
751
    return to_ref(m_value);
102,458,805✔
752
}
102,458,805✔
753

754
inline uint_fast64_t RefOrTagged::get_as_int() const noexcept
755
{
115,372,383✔
756
    // The bitwise AND is there in case uint_fast64_t is wider than 64 bits.
757
    return (uint_fast64_t(m_value) & 0xFFFFFFFFFFFFFFFFULL) >> 1;
115,372,383✔
758
}
115,372,383✔
759

760
inline RefOrTagged RefOrTagged::make_ref(ref_type ref) noexcept
761
{
334,740✔
762
    // from_ref() is defined in <alloc.hpp>
763
    int_fast64_t value = from_ref(ref);
334,740✔
764
    return RefOrTagged(value);
334,740✔
765
}
334,740✔
766

767
inline RefOrTagged RefOrTagged::make_tagged(uint_fast64_t i) noexcept
768
{
25,111,965✔
769
    REALM_ASSERT(i < (1ULL << 63));
25,111,965✔
770
    return RefOrTagged((i << 1) | 1);
25,111,965✔
771
}
25,111,965✔
772

773
inline RefOrTagged::RefOrTagged(int_fast64_t value) noexcept
774
    : m_value(value)
262,098,096✔
775
{
540,121,827✔
776
}
540,121,827✔
777

778
inline void Array::create(Type type, bool context_flag, size_t length, int_fast64_t value)
779
{
11,610,594✔
780
    MemRef mem = create_array(type, context_flag, length, value, m_alloc); // Throws
11,610,594✔
781
    init_from_mem(mem);
11,610,594✔
782
}
11,610,594✔
783

784
inline Array::Type Array::get_type() const noexcept
785
{
18✔
786
    if (m_is_inner_bptree_node) {
18✔
787
        REALM_ASSERT_DEBUG(m_has_refs);
6✔
788
        return type_InnerBptreeNode;
6✔
789
    }
6✔
790
    if (m_has_refs)
12✔
791
        return type_HasRefs;
6✔
792
    return type_Normal;
6✔
793
}
12✔
794

795

796
inline void Array::get_chunk(size_t ndx, int64_t res[8]) const noexcept
797
{
2,703,300✔
798
    REALM_ASSERT_DEBUG(ndx < m_size);
2,703,300✔
799
    m_vtable->chunk_getter(*this, ndx, res);
2,703,300✔
800
}
2,703,300✔
801

802
template <size_t w>
803
inline int64_t Array::get_universal(const char* data, size_t ndx)
804
{
3,773,492,812✔
805
    if (w == 64) {
3,773,492,812✔
806
        size_t offset = ndx << 3;
917,762,376✔
807
        return *reinterpret_cast<const int64_t*>(data + offset);
917,762,376✔
808
    }
917,762,376✔
809
    else if (w == 32) {
3,330,821,869✔
810
        size_t offset = ndx << 2;
2,917,282,783✔
811
        return *reinterpret_cast<const int32_t*>(data + offset);
2,917,282,783✔
812
    }
2,917,282,783✔
813
    else if (w == 16) {
877,154,709✔
814
        size_t offset = ndx << 1;
543,782,334✔
815
        return *reinterpret_cast<const int16_t*>(data + offset);
543,782,334✔
816
    }
543,782,334✔
817
    else if (w == 8) {
333,372,375✔
818
        return *reinterpret_cast<const signed char*>(data + ndx);
71,129,763✔
819
    }
71,129,763✔
820
    else if (w == 4) {
262,242,612✔
821
        size_t offset = ndx >> 1;
37,634,343✔
822
        auto d = data[offset];
37,634,343✔
823
        return (d >> ((ndx & 1) << 2)) & 0x0F;
37,634,343✔
824
    }
37,634,343✔
825
    else if (w == 2) {
224,608,269✔
826
        size_t offset = ndx >> 2;
64,984,452✔
827
        auto d = data[offset];
64,984,452✔
828
        return (d >> ((ndx & 3) << 1)) & 0x03;
64,984,452✔
829
    }
64,984,452✔
830
    else if (w == 1) {
159,623,817✔
831
        size_t offset = ndx >> 3;
59,694,438✔
832
        auto d = data[offset];
59,694,438✔
833
        return (d >> (ndx & 7)) & 0x01;
59,694,438✔
834
    }
59,694,438✔
835
    else if (w == 0) {
101,078,550✔
836
        return 0;
98,942,712✔
837
    }
98,942,712✔
838
    else {
2,149,619,485✔
839
        REALM_ASSERT_DEBUG(false);
2,149,619,485✔
840
        return int64_t(-1);
2,149,619,485✔
841
    }
2,149,619,485✔
842
}
3,773,492,812✔
843

844
inline int64_t Array::front() const noexcept
UNCOV
845
{
×
846
    return get(0);
×
847
}
×
848

849
inline int64_t Array::back() const noexcept
850
{
48,052,983✔
851
    return get(m_size - 1);
48,052,983✔
852
}
48,052,983✔
853

854
inline ref_type Array::get_as_ref(size_t ndx) const noexcept
855
{
865,962,585✔
856
    REALM_ASSERT_DEBUG(is_attached());
865,962,585✔
857
    REALM_ASSERT_DEBUG_EX(m_has_refs, m_ref, ndx, m_size);
865,962,585✔
858
    int64_t v = get(ndx);
865,962,585✔
859
    return to_ref(v);
865,962,585✔
860
}
865,962,585✔
861

862
inline RefOrTagged Array::get_as_ref_or_tagged(size_t ndx) const noexcept
863
{
448,869,786✔
864
    REALM_ASSERT(has_refs());
448,869,786✔
865
    return RefOrTagged(get(ndx));
448,869,786✔
866
}
448,869,786✔
867

868
inline void Array::set(size_t ndx, RefOrTagged ref_or_tagged)
869
{
34,380,792✔
870
    REALM_ASSERT(has_refs());
34,380,792✔
871
    set(ndx, ref_or_tagged.m_value); // Throws
34,380,792✔
872
}
34,380,792✔
873

874
inline void Array::add(RefOrTagged ref_or_tagged)
875
{
1,693,335✔
876
    REALM_ASSERT(has_refs());
1,693,335✔
877
    add(ref_or_tagged.m_value); // Throws
1,693,335✔
878
}
1,693,335✔
879

880
inline void Array::ensure_minimum_width(RefOrTagged ref_or_tagged)
881
{
672✔
882
    REALM_ASSERT(has_refs());
672✔
883
    ensure_minimum_width(ref_or_tagged.m_value); // Throws
672✔
884
}
672✔
885

886
inline bool Array::is_inner_bptree_node() const noexcept
887
{
25,825,356✔
888
    return m_is_inner_bptree_node;
25,825,356✔
889
}
25,825,356✔
890

891
inline bool Array::has_refs() const noexcept
892
{
498,525,090✔
893
    return m_has_refs;
498,525,090✔
894
}
498,525,090✔
895

896
inline void Array::set_has_refs(bool value) noexcept
897
{
×
898
    if (m_has_refs != value) {
×
899
        REALM_ASSERT(!is_read_only());
×
900
        m_has_refs = value;
×
901
        set_hasrefs_in_header(value, get_header());
×
902
    }
×
903
}
×
904

905
inline bool Array::get_context_flag() const noexcept
906
{
33,904,827✔
907
    return m_context_flag;
33,904,827✔
908
}
33,904,827✔
909

910
inline void Array::set_context_flag(bool value) noexcept
911
{
709,683✔
912
    if (m_context_flag != value) {
709,683✔
913
        copy_on_write();
709,638✔
914
        m_context_flag = value;
709,638✔
915
        set_context_flag_in_header(value, get_header());
709,638✔
916
    }
709,638✔
917
}
709,683✔
918

919
inline void Array::destroy_deep() noexcept
920
{
750,846✔
921
    if (!is_attached())
750,846✔
922
        return;
684✔
923

924
    if (m_has_refs)
750,162✔
925
        destroy_children();
748,908✔
926

927
    char* header = get_header_from_data(m_data);
750,162✔
928
    m_alloc.free_(m_ref, header);
750,162✔
929
    m_data = nullptr;
750,162✔
930
}
750,162✔
931

932
inline void Array::add(int_fast64_t value)
933
{
853,341,717✔
934
    insert(m_size, value);
853,341,717✔
935
}
853,341,717✔
936

937
inline void Array::erase(size_t ndx)
938
{
11,636,034✔
939
    // This can throw, but only if array is currently in read-only
940
    // memory.
941
    move(ndx + 1, size(), ndx);
11,636,034✔
942

943
    // Update size (also in header)
944
    --m_size;
11,636,034✔
945
    set_header_size(m_size);
11,636,034✔
946
}
11,636,034✔
947

948

949
inline void Array::erase(size_t begin, size_t end)
950
{
×
951
    if (begin != end) {
×
952
        // This can throw, but only if array is currently in read-only memory.
953
        move(end, size(), begin); // Throws
×
954

955
        // Update size (also in header)
956
        m_size -= end - begin;
×
957
        set_header_size(m_size);
×
958
    }
×
959
}
×
960

961
inline void Array::clear()
962
{
2,066,856✔
963
    truncate(0); // Throws
2,066,856✔
964
}
2,066,856✔
965

966
inline void Array::clear_and_destroy_children()
967
{
19,893✔
968
    truncate_and_destroy_children(0);
19,893✔
969
}
19,893✔
970

971
inline void Array::destroy_deep(ref_type ref, Allocator& alloc) noexcept
972
{
2,634,297✔
973
    destroy_deep(MemRef(ref, alloc), alloc);
2,634,297✔
974
}
2,634,297✔
975

976
inline void Array::destroy_deep(MemRef mem, Allocator& alloc) noexcept
977
{
2,634,249✔
978
    if (!get_hasrefs_from_header(mem.get_addr())) {
2,634,249✔
979
        alloc.free_(mem);
1,958,547✔
980
        return;
1,958,547✔
981
    }
1,958,547✔
982
    Array array(alloc);
675,702✔
983
    array.init_from_mem(mem);
675,702✔
984
    array.destroy_deep();
675,702✔
985
}
675,702✔
986

987

988
inline void Array::adjust(size_t ndx, int_fast64_t diff)
989
{
54,151,743✔
990
    REALM_ASSERT_3(ndx, <=, m_size);
54,151,743✔
991
    if (diff != 0) {
54,161,685✔
992
        // FIXME: Should be optimized
993
        int_fast64_t v = get(ndx);
54,161,685✔
994
        set(ndx, int64_t(v + diff)); // Throws
54,161,685✔
995
    }
54,161,685✔
996
}
54,151,743✔
997

998
inline void Array::adjust(size_t begin, size_t end, int_fast64_t diff)
999
{
2,367,774✔
1000
    if (diff != 0) {
2,367,774✔
1001
        // FIXME: Should be optimized
1002
        for (size_t i = begin; i != end; ++i)
16,048,539✔
1003
            adjust(i, diff); // Throws
14,434,518✔
1004
    }
1,614,021✔
1005
}
2,367,774✔
1006

1007

1008
//-------------------------------------------------
1009

1010

1011
inline size_t Array::get_byte_size() const noexcept
1012
{
34,701,612✔
1013
    const char* header = get_header_from_data(m_data);
34,701,612✔
1014
    size_t num_bytes = NodeHeader::get_byte_size_from_header(header);
34,701,612✔
1015

1016
    REALM_ASSERT_7(m_alloc.is_read_only(m_ref), ==, true, ||, num_bytes, <=, get_capacity_from_header(header));
34,701,612✔
1017

1018
    return num_bytes;
34,701,612✔
1019
}
34,701,612✔
1020

1021

1022
//-------------------------------------------------
1023

1024
inline MemRef Array::create_empty_array(Type type, bool context_flag, Allocator& alloc)
1025
{
1,821,456✔
1026
    size_t size = 0;
1,821,456✔
1027
    int_fast64_t value = 0;
1,821,456✔
1028
    return create_array(type, context_flag, size, value, alloc); // Throws
1,821,456✔
1029
}
1,821,456✔
1030

1031
inline MemRef Array::create_array(Type type, bool context_flag, size_t size, int_fast64_t value, Allocator& alloc)
1032
{
13,762,608✔
1033
    return create(type, context_flag, wtype_Bits, size, value, alloc); // Throws
13,762,608✔
1034
}
13,762,608✔
1035

1036
inline size_t Array::get_max_byte_size(size_t num_elems) noexcept
1037
{
615,486✔
1038
    int max_bytes_per_elem = 8;
615,486✔
1039
    return header_size + num_elems * max_bytes_per_elem;
615,486✔
1040
}
615,486✔
1041

1042
inline void Array::update_child_ref(size_t child_ndx, ref_type new_ref)
1043
{
16,978,746✔
1044
    set(child_ndx, new_ref);
16,978,746✔
1045
}
16,978,746✔
1046

1047
inline ref_type Array::get_child_ref(size_t child_ndx) const noexcept
1048
{
148,379,715✔
1049
    return get_as_ref(child_ndx);
148,379,715✔
1050
}
148,379,715✔
1051

1052
inline void Array::ensure_minimum_width(int_fast64_t value)
1053
{
210,011,472✔
1054
    if (value >= m_lbound && value <= m_ubound)
210,011,472✔
1055
        return;
200,886,630✔
1056
    do_ensure_minimum_width(value);
9,124,842✔
1057
}
9,124,842✔
1058

1059
inline ref_type Array::write(_impl::ArrayWriterBase& out, bool deep, bool only_if_modified,
1060
                             bool compress_in_flight) const
1061
{
8,865,354✔
1062
    REALM_ASSERT_DEBUG(is_attached());
8,865,354✔
1063
    // The default allocator cannot be trusted wrt is_read_only():
1064
    REALM_ASSERT_DEBUG(!only_if_modified || &m_alloc != &Allocator::get_default());
8,865,354✔
1065
    if (only_if_modified && m_alloc.is_read_only(m_ref))
8,865,354✔
1066
        return m_ref;
2,484,753✔
1067

1068
    if (!deep || !m_has_refs) {
6,380,601✔
1069
        // however - creating an array using ANYTHING BUT the default allocator during commit is also wrong....
1070
        // it only works by accident, because the whole slab area is reinitialized after commit.
1071
        // We should have: Array encoded_array{Allocator::get_default()};
1072
        Array compressed_array{Allocator::get_default()};
5,196,768✔
1073
        if (compress_in_flight && compress_array(compressed_array)) {
5,196,768✔
1074
#ifdef REALM_DEBUG
102,087✔
1075
            const auto encoding = compressed_array.m_integer_compressor.get_encoding();
102,087✔
1076
            REALM_ASSERT_DEBUG(encoding == Encoding::Flex || encoding == Encoding::Packed);
102,087✔
1077
            REALM_ASSERT_DEBUG(size() == compressed_array.size());
102,087✔
1078
            for (size_t i = 0; i < compressed_array.size(); ++i) {
14,180,928✔
1079
                REALM_ASSERT_DEBUG(get(i) == compressed_array.get(i));
14,078,841✔
1080
            }
14,078,841✔
1081
#endif
102,087✔
1082
            auto ref = compressed_array.do_write_shallow(out);
102,087✔
1083
            compressed_array.destroy();
102,087✔
1084
            return ref;
102,087✔
1085
        }
102,087✔
1086
        return do_write_shallow(out); // Throws
5,094,681✔
1087
    }
5,196,768✔
1088

1089
    return do_write_deep(out, only_if_modified, compress_in_flight); // Throws
1,183,833✔
1090
}
6,380,601✔
1091

1092
inline ref_type Array::write(ref_type ref, Allocator& alloc, _impl::ArrayWriterBase& out, bool only_if_modified,
1093
                             bool compress_in_flight)
1094
{
71,095,563✔
1095
    // The default allocator cannot be trusted wrt is_read_only():
1096
    REALM_ASSERT_DEBUG(!only_if_modified || &alloc != &Allocator::get_default());
71,095,563✔
1097
    if (only_if_modified && alloc.is_read_only(ref))
71,282,286✔
1098
        return ref;
57,612,372✔
1099

1100
    Array array(alloc);
13,483,191✔
1101
    array.init_from_ref(ref);
13,483,191✔
1102
    REALM_ASSERT_DEBUG(array.is_attached());
13,483,191✔
1103

1104
    if (!array.m_has_refs) {
13,483,191✔
1105
        Array compressed_array{Allocator::get_default()};
11,865,753✔
1106
        if (compress_in_flight && array.compress_array(compressed_array)) {
11,865,753✔
1107
#ifdef REALM_DEBUG
9,288✔
1108
            const auto encoding = compressed_array.m_integer_compressor.get_encoding();
9,288✔
1109
            REALM_ASSERT_DEBUG(encoding == Encoding::Flex || encoding == Encoding::Packed);
9,288✔
1110
            REALM_ASSERT_DEBUG(array.size() == compressed_array.size());
9,288✔
1111
            for (size_t i = 0; i < compressed_array.size(); ++i) {
2,526,435✔
1112
                REALM_ASSERT_DEBUG(array.get(i) == compressed_array.get(i));
2,517,147✔
1113
            }
2,517,147✔
1114
#endif
9,288✔
1115
            auto ref = compressed_array.do_write_shallow(out);
9,288✔
1116
            compressed_array.destroy();
9,288✔
1117
            return ref;
9,288✔
1118
        }
9,288✔
1119
        else {
11,856,465✔
1120
            return array.do_write_shallow(out); // Throws
11,856,465✔
1121
        }
11,856,465✔
1122
    }
11,865,753✔
1123
    return array.do_write_deep(out, only_if_modified, compress_in_flight); // Throws
1,617,438✔
1124
}
13,483,191✔
1125

1126

1127
} // namespace realm
1128

1129
#endif // REALM_ARRAY_HPP
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc