118 return (items_ + size_);
125 return (items_ + size_);
151 assert(index < size_);
153 return items_[index];
161 assert(index < size_);
163 return items_[index];
173 return items_[index];
175 throw std::out_of_range
177 "Index outside of range."
188 return items_[index];
190 throw std::out_of_range
192 "Index outside of range."
206 assert(index < size_);
208 Item*
const toBeUpdated = items_ + index;
210 Item* target = items_ + size_ - 1;
211 Item* source = target - 1;
213 while (target != toBeUpdated)
217 new (target--)
Item(*source--);
228 assert(index < size_);
231 Item*
const toBeErased = items_ + index;
233 Item* target = toBeErased;
234 Item* source = toBeErased + 1;
236 while (source != theEnd)
240 new (target++)
Item(*source++);
257 assert(newSize <= capacity_);
261 while (size_ != newSize)
262 new (items_ + size_++)
Item(item);
266 while (size_ != newSize)
267 (items_ + --size_)->~
Item();
275 const Size capacity_;
293 TargetSize targetSize,
294 SourceSize sourceSize)
299 "Cannot copy items because number "
300 "of source items exceeds target capacity "
303 toStr(error, sourceSize);
305 error +=
",targetCapacity=";
307 toStr(error, targetSize);
311 throw std::runtime_error(error);
327 <TargetItem, TargetSize>&
331 <SourceItem, TargetSize>&
333 SourceSize itemCount =
334 static_cast<SourceSize
>(-1))
336 if (itemCount > source.size())
337 itemCount = source.size();
339 if (itemCount > target.capacity())
348 target.resize(itemCount);
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_BEGIN
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_END
#define ONIXS_CMESTREAMLINEDMDH_NULLPTR
Implements vector-like container over built-in array of fixed size being referenced.
Size capacity() const
Total capacity of container.
void erase(Size index)
Erases item at given position.
Iterator begin()
Iterator referencing to the first item.
SizeType Size
Aliases dimension type.
const Item & operator[](Size index) const
Accesses to item by index.
void resize(Size newSize, const Item &item=Item())
Resizes container.
Item & at(Size index)
Accesses to item by index checking access bounds.
Item & operator[](Size index)
Accesses to item by index.
const Item * ConstIterator
Aliases constant iterator type.
bool empty() const
Indicates whether instance has no items.
ConstIterator end() const
Iterator referencing to the item behind the last item.
ItemType Item
Aliases container item type.
VectorOverArray(Item *items, Size capacity)
Initializes instance over given fixed-size array.
Item & insertExtrude(Size index)
Inserts new item to given position.
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
Accesses to item by index checking access bounds.
VectorOverArray()
Initializes instance with no items.
Item * Iterator
Aliases mutable iterator type.
void throwVectorCopyOverflow(TargetSize targetSize, SourceSize sourceSize)
void copy(VectorOverArray< TargetItem, TargetSize > &target, const VectorOverArray< SourceItem, TargetSize > &source, SourceSize itemCount=static_cast< SourceSize >(-1))
Copies items from source to target.
void toStr(std::string &str, const Decimal &number)