Struct Collection

Array based collection of items.

Retains item order when during add/remove operations.

Optionally destroys removed objects when instanciated with ownItems = true.


Name Type Description
_items T[]
_len size_t


Name Type Description
back [get] T peek last item
empty [get] bool returns true if there are no items in collection
front [get] T peek first item
length [get] size_t returns number of items in collection
length [set] size_t returns number of items in collection
peekBack [get] T peek last item
peekFront [get] T peek first item
popBack [get] T remove last item
popFront [get] T remove first item
size [get] size_t returns currently allocated capacity (may be more than length)
size [set] size_t change capacity (e.g. to reserve big space to avoid multiple reallocations)


Name Description
add insert new item in specified position
addAll add all items from other collection
clear remove all items
indexOf returns index of first occurence of item, size_t.max if not found
opApply support of foreach with reference
opIndex access item by index
opOpAssign support for appending (~=, +=) and removing by value (-=)
pushBack insert item at end of collection
pushFront insert item at beginning of collection
remove remove single item, returning removed item
removeValue remove single item by value - if present in collection, returning true if item was found and removed


Vadim Lopatin,


Vadim Lopatin, 2014


Boost License 1.0