MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ObjectsArray

Class ObjectsArray

src/common/classes/objects_array.h:40–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38{
39 template <typename T, typename A = Array<T*, InlineStorage<T*, 8> > >
40 class ObjectsArray : protected A
41 {
42 private:
43 typedef A inherited;
44 public:
45 class const_iterator; // fwd decl.
46 typedef FB_SIZE_T size_type;
47
48 class iterator
49 {
50 friend class ObjectsArray<T, A>;
51 friend class const_iterator;
52 private:
53 ObjectsArray *lst;
54 size_type pos;
55 iterator(ObjectsArray *l, size_type p) : lst(l), pos(p) { }
56 public:
57 using iterator_category = std::forward_iterator_tag;
58 using difference_type = std::ptrdiff_t;
59 using value_type = T;
60 using pointer = T*;
61 using reference = T&;
62
63 iterator() : lst(0), pos(0) { }
64 iterator(const iterator& it) : lst(it.lst), pos(it.pos) { }
65
66 iterator& operator++()
67 {
68 ++pos;
69 return (*this);
70 }
71 iterator operator++(int)
72 {
73 iterator tmp = *this;
74 ++pos;
75 return tmp;
76 }
77 iterator& operator--()
78 {
79 fb_assert(pos > 0);
80 --pos;
81 return (*this);
82 }
83 iterator operator--(int)
84 {
85 fb_assert(pos > 0);
86 iterator tmp = *this;
87 --pos;
88 return tmp;
89 }
90 T* operator->()
91 {
92 fb_assert(lst);
93 T* pointer = lst->getPointer(pos);
94 return pointer;
95 }
96 T& operator*()
97 {

Callers

nothing calls this directly

Calls 4

popFunction · 0.70
TClass · 0.50
insertFunction · 0.50
addFunction · 0.50

Tested by

no test coverage detected