12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #ifndef REALM_ARRAY_REF_HPP_
- #define REALM_ARRAY_REF_HPP_
- #include <realm/array.hpp>
- namespace realm {
- class ArrayRef : public Array {
- public:
- using value_type = ref_type;
- explicit ArrayRef(Allocator& allocator) noexcept
- : Array(allocator)
- {
- }
- void create(size_t sz = 0)
- {
- Array::create(type_HasRefs, false, sz, 0);
- }
- void add(ref_type value)
- {
- Array::add(from_ref(value));
- }
- void set(size_t ndx, ref_type value)
- {
- Array::set(ndx, from_ref(value));
- }
- void insert(size_t ndx, ref_type value)
- {
- Array::insert(ndx, from_ref(value));
- }
- ref_type get(size_t ndx) const noexcept
- {
- return to_ref(Array::get(ndx));
- }
- void verify() const
- {
- #ifdef REALM_DEBUG
- Array::verify();
- REALM_ASSERT(has_refs());
- #endif
- }
- };
- }
- #endif
|