36template <
typename ItemType,
typename SizeType>
107 return (items_ + size_);
113 return (items_ + size_);
135 assert(index < size_);
137 return items_[index];
143 assert(index < size_);
145 return items_[index];
153 return items_[index];
155 throw std::out_of_range(
"Index outside of range.");
163 return items_[index];
165 throw std::out_of_range(
"Index outside of range.");
177 assert(index < size_);
179 Item*
const toBeUpdated = items_ + index;
181 Item* target = items_ + size_ - 1;
182 Item* source = target - 1;
184 while (target != toBeUpdated)
188 new (target--)
Item(*source--);
197 assert(index < size_);
200 Item*
const toBeErased = items_ + index;
202 Item* target = toBeErased;
203 Item* source = toBeErased + 1;
205 while (source != theEnd)
209 new (target++)
Item(*source++);
223 assert(newSize <= capacity_);
227 while (size_ != newSize)
228 new (items_ + size_++)
Item(item);
232 while (size_ != newSize)
233 (items_ + --size_)->~
Item();
241 const Size capacity_;
249template <
typename TargetSize,
typename SourceSize>
254 error +=
"Cannot copy items because number "
255 "of source items exceeds target capacity "
260 error +=
",targetCapacity=";
266 throw std::runtime_error(error);
272template <
typename TargetItem,
typename TargetSize,
typename SourceItem,
typename SourceSize>
276 SourceSize itemCount =
static_cast<SourceSize
>(-1)
279 itemCount = (itemCount > source.
size()) ? source.
size() : itemCount;
292 target[itemCount] = source[itemCount];
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_NAMESPACE_END
void erase(Size index)
Erases item at given position.
Iterator begin()
Iterator referencing to the first item.
const Item & operator[](Size index) const
Accesses to item by index.
void resize(Size newSize, const Item &item=Item())
Item & operator[](Size index)
Accesses to item by index.
const Item * ConstIterator
bool empty() const
Indicates whether instance has no items.
ConstIterator end() const
Iterator referencing to the item behind the last item.
VectorOverArray(Item *items, Size capacity)
Initializes instance over given fixed-size array.
Item & insertExtrude(Size index)
const Item & front() const
Provides access to the front item if available.
Iterator end()
Iterator referencing to the item behind the last item.
Size size() const
Number of items.
ConstIterator begin() const
Iterator referencing to the first item.
~VectorOverArray()
Cleans everything up.
Item & front()
Provides access to the front item if available.
const Item & at(Size index) const
VectorOverArray()
Initializes instance with no items.
void toStr(std::string &, Int8)
Serializes given integer into a string.
void throwVectorCopyOverflow(TargetSize targetSize, SourceSize sourceSize)
MboBook & copy(MboBook &target, const MboBook &source)
Copies content of MBO book to the other one.