Loading...
Searching...
No Matches
STL-like API

Typedefs

using iterator = ElementType *
 Iterator type.
 
using const_iterator = ElementType const *
 Const iterator type.
 
typedef std::reverse_iterator< iteratorreverse_iterator
 Reverse iterator type.
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 Reverse const iterator type.
 
typedef ElementTypereference
 Reference type.
 
typedef ElementType const & const_reference
 Const reference type.
 
typedef ElementTypepointer
 Pointer type.
 
typedef ElementType const * const_pointer
 Const pointer type.
 

Functions

iterator begin ()
 Return a non-const iterator to the start of the array.
 
iterator end ()
 Returns a non-const iterator to the end of the array.
 
const_iterator begin () const
 Return a const iterator to the start of the array.
 
const_iterator end () const
 Return a const iterator to the end of the array.
 
const_iterator cbegin () const
 Return a const iterator to the start of the array.
 
const_iterator cend () const
 Return a const iterator to the end of the array.
 
reverse_iterator rbegin ()
 Return a non-const reverse iterator to the end of the array.
 
reverse_iterator rend ()
 Return a reverse iterator to the start of the array.
 
const_reverse_iterator rbegin () const
 Return a const reverse iterator to the end of the array.
 
const_reverse_iterator rend () const
 Return a const reverse iterator to the start of the array.
 
const_reverse_iterator crbegin () const
 Return a const reverse iterator to the end of the array.
 
const_reverse_iterator crend () const
 Return a const reverse iterator to the start of the array.
 
pointer data ()
 Return a non-const pointer to this array's data.
 
const_pointer data () const
 Return a const pointer to this array's data.
 
const_pointer cdata () const
 Return a const pointer to the data held by this array.
 
template<typename... Args>
void emplace_back (Args &&... args)
 Initializes a new element at the end of the array.
 
void push_back (ElementType const &element)
 Appends an element at the end of the array.
 
void push_back (ElementType &&element)
 Appends an element at the end of the array.
 
void pop_back ()
 Remove the last element of an array.
 
size_t size () const
 Return the total number of elements in this array.
 
size_t capacity () const
 Return the number of items this container can grow to hold without triggering a (re)allocation.
 
constexpr size_t max_size () const
 Return a theoretical maximum size limit for the container.
 
bool empty () const
 Return true if this array contains no elements, false otherwise.
 
void reserve (size_t num)
 Ensure enough memory is allocated to hold num elements.
 
reference front ()
 Return a non-const reference to the first element in this array.
 
const_reference front () const
 Return a const reference to the first element in this array.
 
const_reference cfront () const
 Return a const reference to the first element in this array.
 
reference back ()
 Return a reference to the last element in this array.
 
const_reference back () const
 Return a const reference to the last element in this array.
 
const_reference cback () const
 Return a const reference to the last element in this array.
 
void resize (size_t newSize)
 Resize this array.
 
void resize (size_t newSize, value_type const &value)
 Resize this array.
 
void resize (size_t newSize, value_type &value)
 Resize this array.
 
void resize (size_t newSize, value_type &&value)
 Resize this array.
 
template<class FillElemsFn >
void resize (size_t newSize, FillElemsFn &&fillElems)
 Resize this array.
 
void clear ()
 Equivalent to resize(0).
 
iterator erase (const_iterator pos)
 Removes a single element at pos from the array.
 
iterator erase (const_iterator first, const_iterator last)
 Remove a range of elements [first, last) from the array.
 
template<class ForwardIter >
std::enable_if<!std::is_integral< ForwardIter >::value >::type assign (ForwardIter first, ForwardIter last)
 Assign array contents.
 
void assign (size_t n, const value_type &fill)
 Assign array contents.
 
void assign (std::initializer_list< ELEM > initializerList)
 Assign array contents via intializer list Equivalent to:
 
void swap (VtArray &other)
 Swap the contents of this array with other.
 

Detailed Description

Typedef Documentation

◆ const_iterator

using const_iterator = ElementType const *

Const iterator type.

Definition at line 241 of file array.h.

◆ const_pointer

typedef ElementType const* const_pointer

Const pointer type.

Definition at line 255 of file array.h.

◆ const_reference

typedef ElementType const& const_reference

Const reference type.

Definition at line 251 of file array.h.

◆ const_reverse_iterator

typedef std::reverse_iterator<const_iterator> const_reverse_iterator

Reverse const iterator type.

Definition at line 246 of file array.h.

◆ iterator

using iterator = ElementType *

Iterator type.

Definition at line 239 of file array.h.

◆ pointer

typedef ElementType* pointer

Pointer type.

Definition at line 253 of file array.h.

◆ reference

Reference type.

Definition at line 249 of file array.h.

◆ reverse_iterator

typedef std::reverse_iterator<iterator> reverse_iterator

Reverse iterator type.

Definition at line 244 of file array.h.

Function Documentation

◆ assign() [1/3]

std::enable_if<!std::is_integral< ForwardIter >::value >::type assign ( ForwardIter  first,
ForwardIter  last 
)
inline

Assign array contents.

Equivalent to:

array.resize(std::distance(first, last));
std::copy(first, last, array.begin());

Definition at line 743 of file array.h.

◆ assign() [2/3]

void assign ( size_t  n,
const value_type &  fill 
)
inline

Assign array contents.

Equivalent to:

array.resize(n);
std::fill(array.begin(), array.end(), fill);

Definition at line 760 of file array.h.

◆ assign() [3/3]

void assign ( std::initializer_list< ELEM >  initializerList)
inline

Assign array contents via intializer list Equivalent to:

array.assign(list.begin(), list.end());

Definition at line 776 of file array.h.

◆ back() [1/2]

reference back ( )
inline

Return a reference to the last element in this array.

The underlying data is copied if it is not uniquely owned. Invokes undefined behavior if the array is empty.

Definition at line 545 of file array.h.

◆ back() [2/2]

const_reference back ( ) const
inline

Return a const reference to the last element in this array.

Invokes undefined behavior if the array is empty.

Definition at line 548 of file array.h.

◆ begin() [1/2]

iterator begin ( )
inline

Return a non-const iterator to the start of the array.

The underlying data is copied if it is not uniquely owned.

Definition at line 380 of file array.h.

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Return a const iterator to the start of the array.

Definition at line 386 of file array.h.

◆ capacity()

size_t capacity ( ) const
inline

Return the number of items this container can grow to hold without triggering a (re)allocation.

Note that if the underlying data is not uniquely owned, a reallocation can occur upon object insertion even if there is remaining capacity.

Definition at line 495 of file array.h.

◆ cback()

const_reference cback ( ) const
inline

Return a const reference to the last element in this array.

Invokes undefined behavior if the array is empty.

Definition at line 551 of file array.h.

◆ cbegin()

const_iterator cbegin ( ) const
inline

Return a const iterator to the start of the array.

Definition at line 391 of file array.h.

◆ cdata()

const_pointer cdata ( ) const
inline

Return a const pointer to the data held by this array.

Definition at line 422 of file array.h.

◆ cend()

const_iterator cend ( ) const
inline

Return a const iterator to the end of the array.

Definition at line 393 of file array.h.

◆ cfront()

const_reference cfront ( ) const
inline

Return a const reference to the first element in this array.

Invokes undefined behavior if the array is empty.

Definition at line 540 of file array.h.

◆ clear()

void clear ( )
inline

Equivalent to resize(0).

Definition at line 643 of file array.h.

◆ crbegin()

const_reverse_iterator crbegin ( ) const
inline

Return a const reverse iterator to the end of the array.

Definition at line 412 of file array.h.

◆ crend()

const_reverse_iterator crend ( ) const
inline

Return a const reverse iterator to the start of the array.

Definition at line 414 of file array.h.

◆ data() [1/2]

pointer data ( )
inline

Return a non-const pointer to this array's data.

The underlying data is copied if it is not uniquely owned.

Definition at line 418 of file array.h.

◆ data() [2/2]

const_pointer data ( ) const
inline

Return a const pointer to this array's data.

Definition at line 420 of file array.h.

◆ emplace_back()

void emplace_back ( Args &&...  args)
inline

Initializes a new element at the end of the array.

The underlying data is first copied if it is not uniquely owned.

See also
push_back(ElementType const&)
push_back(ElementType&&)

Definition at line 430 of file array.h.

◆ empty()

bool empty ( ) const
inline

Return true if this array contains no elements, false otherwise.

Definition at line 515 of file array.h.

◆ end() [1/2]

iterator end ( )
inline

Returns a non-const iterator to the end of the array.

The underlying data is copied if it is not uniquely owned.

Definition at line 383 of file array.h.

◆ end() [2/2]

const_iterator end ( ) const
inline

Return a const iterator to the end of the array.

Definition at line 388 of file array.h.

◆ erase() [1/2]

iterator erase ( const_iterator  first,
const_iterator  last 
)
inline

Remove a range of elements [first, last) from the array.

To match the behavior of std::vector, returns an iterator at the position following the removed element. If no elements are removed, a non-const iterator pointing to last will be returned.

Since the returned iterator is mutable, when the array is not uniquely owned, a copy will be required even when the contents are unchanged.

Erase invalidates all iterators (unlike std::vector where iterators prior to first remain valid).

See also
erase(const_iterator)

Definition at line 691 of file array.h.

◆ erase() [2/2]

iterator erase ( const_iterator  pos)
inline

Removes a single element at pos from the array.

To match the behavior of std::vector, returns an iterator pointing to the position following the removed element.

Since the returned iterator is mutable, when the array is not uniquely owned, a copy will be required.

Erase invalidates all iterators (unlike std::vector where iterators prior to pos remain valid).

See also
erase(const_iterator, const_iterator)

Definition at line 671 of file array.h.

◆ front() [1/2]

reference front ( )
inline

Return a non-const reference to the first element in this array.

The underlying data is copied if it is not uniquely owned. Invokes undefined behavior if the array is empty.

Definition at line 534 of file array.h.

◆ front() [2/2]

const_reference front ( ) const
inline

Return a const reference to the first element in this array.

Invokes undefined behavior if the array is empty.

Definition at line 537 of file array.h.

◆ max_size()

constexpr size_t max_size ( ) const
inlineconstexpr

Return a theoretical maximum size limit for the container.

In practice this size is unachievable due to the amount of available memory or other system limitations.

Definition at line 507 of file array.h.

◆ pop_back()

void pop_back ( )
inline

Remove the last element of an array.

The underlying data is first copied if it is not uniquely owned.

Definition at line 475 of file array.h.

◆ push_back() [1/2]

void push_back ( ElementType &&  element)
inline

Appends an element at the end of the array.

The underlying data is first copied if it is not uniquely owned.

See also
emplace_back
push_back(ElementType const&)

Definition at line 469 of file array.h.

◆ push_back() [2/2]

void push_back ( ElementType const &  element)
inline

Appends an element at the end of the array.

The underlying data is first copied if it is not uniquely owned.

See also
emplace_back
push_back(ElementType&&)

Definition at line 460 of file array.h.

◆ rbegin() [1/2]

reverse_iterator rbegin ( )
inline

Return a non-const reverse iterator to the end of the array.

The underlying data is copied if it is not uniquely owned.

Definition at line 397 of file array.h.

◆ rbegin() [2/2]

const_reverse_iterator rbegin ( ) const
inline

Return a const reverse iterator to the end of the array.

Definition at line 403 of file array.h.

◆ rend() [1/2]

reverse_iterator rend ( )
inline

Return a reverse iterator to the start of the array.

The underlying data is copied if it is not uniquely owned.

Definition at line 400 of file array.h.

◆ rend() [2/2]

const_reverse_iterator rend ( ) const
inline

Return a const reverse iterator to the start of the array.

Definition at line 407 of file array.h.

◆ reserve()

void reserve ( size_t  num)
inline

Ensure enough memory is allocated to hold num elements.

Note that this currently does not ensure that the underlying data is uniquely owned. If that is desired, invoke a method like data() first.

Definition at line 520 of file array.h.

◆ resize() [1/5]

void resize ( size_t  newSize)
inline

Resize this array.

Preserve existing elements that remain, value-initialize any newly added elements. For example, calling resize(10) on an array of size 5 would change the size to 10, the first 5 elements would be left unchanged and the last 5 elements would be value-initialized.

Definition at line 558 of file array.h.

◆ resize() [2/5]

void resize ( size_t  newSize,
FillElemsFn &&  fillElems 
)
inline

Resize this array.

Preserve existing elements that remain, initialize any newly added elements by calling fillElems(first, last). Note that this function is passed pointers to uninitialized memory, so the elements must be filled with something like placement-new.

Definition at line 588 of file array.h.

◆ resize() [3/5]

void resize ( size_t  newSize,
value_type &&  value 
)
inline

Resize this array.

Preserve existing elements that remain, initialize any newly added elements by copying value.

Definition at line 579 of file array.h.

◆ resize() [4/5]

void resize ( size_t  newSize,
value_type &  value 
)
inline

Resize this array.

Preserve existing elements that remain, initialize any newly added elements by copying value.

Definition at line 573 of file array.h.

◆ resize() [5/5]

void resize ( size_t  newSize,
value_type const &  value 
)
inline

Resize this array.

Preserve existing elements that remain, initialize any newly added elements by copying value.

Definition at line 564 of file array.h.

◆ size()

size_t size ( ) const
inline

Return the total number of elements in this array.

Definition at line 489 of file array.h.

◆ swap()

void swap ( VtArray< ELEM > &  other)
inline

Swap the contents of this array with other.

Definition at line 781 of file array.h.