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_);
230 Item*
const theEnd = end();
231 Item*
const toBeErased = items_ + index;
233 Item* target = toBeErased;
234 Item* source = toBeErased + 1;
236 while (source != theEnd)
240 new (target++) Item(*source++);
255 const Item& item = Item())
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))
352 target.resize(itemCount);
ConstIterator end() const
Iterator referencing to the item behind the last item.
SizeType Size
Aliases dimension type.
VectorOverArray()
Initializes instance with no items.
void erase(Size index)
Erases item at given position.
void resize(Size newSize, const Item &item=Item())
Iterator end()
Iterator referencing to the item behind the last item.
const Item & front() const
Provides access to the front item if available.
void toStr(std::string &str, const Message &message)
Serializes FIX message into tag=value format.
ItemType Item
Aliases container item type.
void throwVectorCopyOverflow(TargetSize targetSize, SourceSize sourceSize)
Iterator begin()
Iterator referencing to the first item.
Size capacity() const
Total capacity of container.
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
const Item & operator[](Size index) const
Accesses to item by index.
void copy(VectorOverArray< TargetItem, TargetSize > &target, const VectorOverArray< SourceItem, TargetSize > &source, SourceSize itemCount=static_cast< SourceSize >(-1))
VectorOverArray(Item *items, Size capacity)
Initializes instance over given fixed-size array.
ConstIterator begin() const
Iterator referencing to the first item.
bool empty() const
Indicates whether instance has no items.
Item & front()
Provides access to the front item if available.
Item & operator[](Size index)
Accesses to item by index.
const Item * ConstIterator
Aliases constant iterator type.
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
const Item & at(Size index) const
~VectorOverArray()
Cleans everything up.
Item & insertExtrude(Size index)
Item * Iterator
Aliases mutable iterator type.
Size size() const
Number of items.