Bifrost SDK
Bifrost SDK documentation
Amino::Array< T > Class Template Reference

Define a Amino array of elements of type T. More...

#include <Array.h>

Inheritance diagram for Amino::Array< T >:

Public Types

using value_type = typename BaseClass::value_type
 The type of the value being stored in the array. Equivalent to T. More...
 
using pointer = typename BaseClass::pointer
 Type to represent a mutable pointer to an array element value. Equivalent to value_type*. More...
 
using const_pointer = typename BaseClass::const_pointer
 Type to represent a constant pointer to an array element value. Equivalent to value_type const*. More...
 
using reference = typename BaseClass::reference
 Type to represent a mutable reference to an array element value. Equivalent to value_type&. More...
 
using const_reference = typename BaseClass::const_reference
 Type to represent a constant reference to an array element value. Equivalent to value_type const&. More...
 
using difference_type = typename BaseClass::difference_type
 A signed integral type. Usually the same as ptrdiff_t. More...
 
using size_type = typename BaseClass::size_type
 An unsigned integral that can represent any non-negative value of difference_type. Usually the same as size_t. More...
 
using iterator = typename BaseClass::iterator
 Type representing a random-access iterator to a value_type. More...
 
using const_iterator = typename BaseClass::const_iterator
 Type representing a random-access iterator to a const value_type. More...
 

Public Member Functions

 Array ()
 Construct an empty array. More...
 
 Array (size_type n)
 Construct an array with n default initialized elements. More...
 
 Array (size_type n, const value_type &value)
 Construct an array with n elements of value value. More...
 
template<class InputIterator , typename = enable_if_input_iterator_t<InputIterator>>
 Array (InputIterator first, InputIterator last)
 Construct an array with the values in the range [first,last), in the same order. More...
 
 Array (std::initializer_list< value_type > init)
 Construct an array with the contents of the initializer_list. More...
 
 Array (const Array< T > &other)=default
 Copy constructor. More...
 
 Array (Array< T > &&other) noexcept=default
 Move constructor. More...
 
 ~Array ()=default
 Destroys the array. This calls the destructor for each element, and releases all the storage allocated by the array. More...
 
Array< T > & operator= (const Array< T > &other)=default
 Copy assignment operator. More...
 
Array< T > & operator= (Array< T > &&other) noexcept=default
 Move assignment operator. More...
 
Array< T > & operator= (std::initializer_list< value_type > init)
 Copy all the elements from init into the current array. More...
 
void assign (size_type count, const value_type &value)
 Replaces the contents of the container with count copies of value value. More...
 
template<class InputIterator , typename = enable_if_input_iterator_t<InputIterator>>
void assign (InputIterator first, InputIterator last)
 Replaces the contents of the container with copies of those in the range [first,last). More...
 
void assign (std::initializer_list< T > init)
 Replaces the contents of the container with the elements from the initializer list init. More...
 
bool empty () const noexcept
 Check whether the array is empty (size() == 0). More...
 
size_type size () const noexcept
 Get the number of elements in the array. More...
 
size_type max_size () const
 Return the maximum number of elements the array is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest possible container. More...
 
void reserve (size_type new_capacity)
 Increase the capacity of the array to a value that's greater or equal to new_capacity. More...
 
size_type capacity () const noexcept
 Get the number of elements that the container has currently allocated space for. More...
 
void shrink_to_fit () noexcept
 Requests the removal of unused capacity. More...
 
void clear () noexcept
 Removes all elements from the container. More...
 
iterator insert (const_iterator pos, size_type count, const value_type &value)
 Inserts count copies of the value before pos. More...
 
template<class InputIterator , typename = enable_if_input_iterator_t<InputIterator>>
iterator insert (const_iterator pos, InputIterator first, InputIterator last)
 Inserts elements from range [first,last) before pos. More...
 
iterator insert (const_iterator pos, std::initializer_list< value_type > init)
 inserts elements from initializer list init before pos. More...
 
iterator erase (const_iterator pos)
 Removes the element at pos from the container. More...
 
iterator erase (const_iterator first, const_iterator last)
 Removes the elements in the range [first,last) from the container. More...
 
template<typename... Args, typename = enable_if_constructible_t<Args...>>
void emplace_back (Args &&... args)
 Appends an element constructed from the given arguments to the end of the container. More...
 
void pop_back ()
 Removes the last element of the container. More...
 
void resize (size_type count)
 Resizes the container to contain count elements. More...
 
void resize (size_type count, const value_type &value)
 Resizes the container to contain count elements. More...
 
void swap (Array &other) noexcept
 Exchange the content of the array by the content of other, which is another array object containing elements of the same type. More...
 
reference at (size_type n)
 Get a reference to the element at position n in the array. More...
 
const_reference at (size_type n) const
 Get a reference to the element at position n in the array. More...
 
reference operator[] (size_type n)
 Get a reference to the element at position n in the array. More...
 
const_reference operator[] (size_type n) const
 Get a reference to the element at position n in the array. More...
 
reference front ()
 Get a reference to the first element in the array. More...
 
const_reference front () const
 Get a reference to the first element in the array. More...
 
reference back ()
 Get a reference to the last element in the array. More...
 
const_reference back () const
 Get a reference to the last element in the array. More...
 
pointer data () noexcept
 Get a pointer to the underlying storage of the array. More...
 
const_pointer data () const noexcept
 Get a pointer to the underlying storage of the array. More...
 
iterator begin () noexcept
 Get a iterator pointing to the first element in the array. More...
 
const_iterator begin () const noexcept
 Get a iterator pointing to the first element in the array. More...
 
const_iterator cbegin () const noexcept
 Get a iterator pointing to the first element in the array. More...
 
iterator end () noexcept
 Get a iterator pointing to the element just past the last element in the array (past-the-end element). More...
 
const_iterator end () const noexcept
 Get a iterator pointing to the element just past the last element in the array (past-the-end element). More...
 
const_iterator cend () const noexcept
 Get a iterator pointing to the element just past the last element in the array (past-the-end element). More...
 
iterator insert (const_iterator pos, const value_type &value)
 Inserts value before pos. More...
 
iterator insert (const_iterator pos, value_type &&value)
 Inserts value before pos. More...
 
void push_back (const value_type &value)
 Appends the given element value to the end of the container. More...
 
void push_back (value_type &&value)
 Appends the given element value to the end of the container. More...
 

Detailed Description

template<typename T>
class Amino::Array< T >

Define a Amino array of elements of type T.

Amino Arrays are resizable containers of contiguous elements.

Warning
Amino::Array is NOT a replacement for other contiguous containers (like std::vector). Amino::Array is only meant to be used within an Amino graph. Therefore, if a value never needs to flow directly into the graph, a standard container (like std::vector) should be used instead.

Amino Arrays of any Amino-known types can be used in Amino graphs, but they must always be memory managed by Amino::Ptr. If the element type is itself an Array or a custom user class, it must also be managed by an Amino::Ptr.

Warning
Amino::Array is not a replacement for std::vector or any other random access container. It is a type primarily meant to be used in Amino graphs (since its internal layout and details are known to the compiler).
Template Parameters
TThe type of the elements.

Definition at line 105 of file Array.h.

Member Typedef Documentation

◆ const_iterator

template<typename T >
using Amino::Array< T >::const_iterator = typename BaseClass::const_iterator

Type representing a random-access iterator to a const value_type.

Definition at line 149 of file Array.h.

◆ const_pointer

template<typename T >
using Amino::Array< T >::const_pointer = typename BaseClass::const_pointer

Type to represent a constant pointer to an array element value. Equivalent to value_type const*.

Definition at line 127 of file Array.h.

◆ const_reference

template<typename T >
using Amino::Array< T >::const_reference = typename BaseClass::const_reference

Type to represent a constant reference to an array element value. Equivalent to value_type const&.

Definition at line 135 of file Array.h.

◆ difference_type

template<typename T >
using Amino::Array< T >::difference_type = typename BaseClass::difference_type

A signed integral type. Usually the same as ptrdiff_t.

Definition at line 138 of file Array.h.

◆ iterator

template<typename T >
using Amino::Array< T >::iterator = typename BaseClass::iterator

Type representing a random-access iterator to a value_type.

Definition at line 145 of file Array.h.

◆ pointer

template<typename T >
using Amino::Array< T >::pointer = typename BaseClass::pointer

Type to represent a mutable pointer to an array element value. Equivalent to value_type*.

Definition at line 123 of file Array.h.

◆ reference

template<typename T >
using Amino::Array< T >::reference = typename BaseClass::reference

Type to represent a mutable reference to an array element value. Equivalent to value_type&.

Definition at line 131 of file Array.h.

◆ size_type

template<typename T >
using Amino::Array< T >::size_type = typename BaseClass::size_type

An unsigned integral that can represent any non-negative value of difference_type. Usually the same as size_t.

Definition at line 142 of file Array.h.

◆ value_type

template<typename T >
using Amino::Array< T >::value_type = typename BaseClass::value_type

The type of the value being stored in the array. Equivalent to T.

Definition at line 119 of file Array.h.

Constructor & Destructor Documentation

◆ Array() [1/7]

template<typename T >
Amino::Array< T >::Array ( )
inlineexplicit

Construct an empty array.

Definition at line 168 of file Array.h.

◆ Array() [2/7]

template<typename T >
Amino::Array< T >::Array ( size_type  n)
inlineexplicit

Construct an array with n default initialized elements.

Parameters
nThe array size.

Definition at line 173 of file Array.h.

◆ Array() [3/7]

template<typename T >
Amino::Array< T >::Array ( size_type  n,
const value_type value 
)
inline

Construct an array with n elements of value value.

Parameters
nThe array size.
valueThe value to fill the array.

Definition at line 181 of file Array.h.

◆ Array() [4/7]

template<typename T >
template<class InputIterator , typename = enable_if_input_iterator_t<InputIterator>>
Amino::Array< T >::Array ( InputIterator  first,
InputIterator  last 
)
inline

Construct an array with the values in the range [first,last), in the same order.

The range used is [first,last), which includes all the elements between first and last, including the element pointed by first, but not the element pointed by last.

Template Parameters
InputIteratorInput iterator type.
Parameters
firstInput iterator to the first position in the range.
lastInput iterator to the last position in the range.

Definition at line 199 of file Array.h.

◆ Array() [5/7]

template<typename T >
Amino::Array< T >::Array ( std::initializer_list< value_type init)
inline

Construct an array with the contents of the initializer_list.

Parameters
initThe initializer list.

Definition at line 206 of file Array.h.

◆ Array() [6/7]

template<typename T >
Amino::Array< T >::Array ( const Array< T > &  other)
default

Copy constructor.

Construct a new array containing a copy of the elements in other, in the same order.

Parameters
otherAn array of the same type whose elements are to be copied.

◆ Array() [7/7]

template<typename T >
Amino::Array< T >::Array ( Array< T > &&  other)
defaultnoexcept

Move constructor.

Construct a new array taking ownership of the elements in other.

Parameters
otherAn array of the same type whose elements are to be copied.

◆ ~Array()

template<typename T >
Amino::Array< T >::~Array ( )
default

Destroys the array. This calls the destructor for each element, and releases all the storage allocated by the array.

Member Function Documentation

◆ assign() [1/3]

template<typename T >
template<class InputIterator , typename = enable_if_input_iterator_t<InputIterator>>
void Amino::Array< T >::assign ( InputIterator  first,
InputIterator  last 
)
inline

Replaces the contents of the container with copies of those in the range [first,last).

Note
This is almost equivalent to *this = Array<T>(first, last) except that the already allocated memory by *this may be reused if its capacity is large enough to hold std::distance(first, last) elements.
Parameters
firstiterator to first element to copy
lastend iterator of range to copy
Note
Any elements held in the array before this call are destroyed.
Container size will the same as the range after the call.

Definition at line 286 of file Array.h.

◆ assign() [2/3]

template<typename T >
void Amino::Array< T >::assign ( size_type  count,
const value_type value 
)
inline

Replaces the contents of the container with count copies of value value.

Note
This is almost equivalent to *this = Array<T>(count, value) except that the already allocated memory by *this may be reused if its capacity is large enough to hold count elements.
Parameters
countthe new size of the container.
valuethe value to initialize elements of the container with.
Note
Any elements held in the array before this call are destroyed.

Definition at line 266 of file Array.h.

◆ assign() [3/3]

template<typename T >
void Amino::Array< T >::assign ( std::initializer_list< T >  init)
inline

Replaces the contents of the container with the elements from the initializer list init.

Note
This is almost equivalent to *this = Array<T>(init) except that the already allocated memory by *this may be reused if its capacity is large enough to hold std::distance(first, last) elements.
Parameters
initinitializer list to copy the values from
Note
Any elements held in the current array before this call are destroyed.
Container size will the same as the initializer list after the call.

Definition at line 305 of file Array.h.

◆ at() [1/2]

template<typename T >
reference Amino::Array< T >::at ( size_type  n)
inline

Get a reference to the element at position n in the array.

Warning
Unlike std::vector::at(), Amino::Array::at() asserts if n >= size(). That's because Amino::Array does not throw any exceptions, so it asserts instead.
Precondition
n < size()
Parameters
nThe index of the element in the array.
Returns
A reference to the element at position n in the array.

Definition at line 323 of file Array.h.

◆ at() [2/2]

template<typename T >
const_reference Amino::Array< T >::at ( size_type  n) const
inline

Get a reference to the element at position n in the array.

Warning
Unlike std::vector::at(), Amino::Array::at() asserts if n >= size(). That's because Amino::Array does not throw any exceptions, so it asserts instead.
Precondition
n < size()
Parameters
nThe index of the element in the array.
Returns
A reference to the element at position n in the array.

Definition at line 324 of file Array.h.

◆ back() [1/2]

template<typename T >
reference Amino::Array< T >::back ( )
inline

Get a reference to the last element in the array.

Unlike end(), which returns an iterator just past the last element in the array, this function returns a direct reference to the last element.

Precondition
!empty()
Returns
A reference to the last element in the array.

Definition at line 363 of file Array.h.

◆ back() [2/2]

template<typename T >
const_reference Amino::Array< T >::back ( ) const
inline

Get a reference to the last element in the array.

Unlike end(), which returns an iterator just past the last element in the array, this function returns a direct reference to the last element.

Precondition
!empty()
Returns
A reference to the last element in the array.

Definition at line 364 of file Array.h.

◆ begin() [1/2]

template<typename T >
const_iterator Amino::Array< T >::begin ( ) const
inlinenoexcept

Get a iterator pointing to the first element in the array.

Unlike front(), which returns a direct reference to the first element in the array, this function returns a random-access iterator pointing to the first element. If the array is empty, the returned iterator is the same as end().

Returns
An iterator to the first element in the array.

Definition at line 387 of file Array.h.

◆ begin() [2/2]

template<typename T >
iterator Amino::Array< T >::begin ( )
inlinenoexcept

Get a iterator pointing to the first element in the array.

Unlike front(), which returns a direct reference to the first element in the array, this function returns a random-access iterator pointing to the first element. If the array is empty, the returned iterator is the same as end().

Returns
An iterator to the first element in the array.

Definition at line 386 of file Array.h.

◆ capacity()

template<typename T >
size_type Amino::Array< T >::capacity ( ) const
inlinenoexcept

Get the number of elements that the container has currently allocated space for.

Returns
The number of elements that the container has currently allocated space for.

Definition at line 446 of file Array.h.

◆ cbegin()

template<typename T >
const_iterator Amino::Array< T >::cbegin ( ) const
inlinenoexcept

Get a iterator pointing to the first element in the array.

Unlike front(), which returns a direct reference to the first element in the array, this function returns a random-access iterator pointing to the first element. If the array is empty, the returned iterator is the same as end().

Returns
An iterator to the first element in the array.

Definition at line 388 of file Array.h.

◆ cend()

template<typename T >
const_iterator Amino::Array< T >::cend ( ) const
inlinenoexcept

Get a iterator pointing to the element just past the last element in the array (past-the-end element).

Unlike back(), which returns a reference to the last element in the array, this function returns a random-access iterator pointing past the last element. This iterator does not point to any valid element, and therefore should not be dereferenced. If the array is empty, the returned iterator is the same as begin().

Returns
An iterator pointing past the last element in the array.

Definition at line 404 of file Array.h.

◆ clear()

template<typename T >
void Amino::Array< T >::clear ( )
inlinenoexcept

Removes all elements from the container.

Note
Leaves capacity unchanged.

Definition at line 455 of file Array.h.

◆ data() [1/2]

template<typename T >
const_pointer Amino::Array< T >::data ( ) const
inlinenoexcept

Get a pointer to the underlying storage of the array.

Returns
A pointer to the underlying storage of the array.

Definition at line 372 of file Array.h.

◆ data() [2/2]

template<typename T >
pointer Amino::Array< T >::data ( )
inlinenoexcept

Get a pointer to the underlying storage of the array.

Returns
A pointer to the underlying storage of the array.

Definition at line 371 of file Array.h.

◆ emplace_back()

template<typename T >
template<typename... Args, typename = enable_if_constructible_t<Args...>>
void Amino::Array< T >::emplace_back ( Args &&...  args)
inline

Appends an element constructed from the given arguments to the end of the container.

Warning
This assumes the constructor taking the given arguments does not throw.

Definition at line 561 of file Array.h.

◆ empty()

template<typename T >
bool Amino::Array< T >::empty ( ) const
inlinenoexcept

Check whether the array is empty (size() == 0).

Returns
true if the array is empty, false otherwise.

Definition at line 412 of file Array.h.

◆ end() [1/2]

template<typename T >
const_iterator Amino::Array< T >::end ( ) const
inlinenoexcept

Get a iterator pointing to the element just past the last element in the array (past-the-end element).

Unlike back(), which returns a reference to the last element in the array, this function returns a random-access iterator pointing past the last element. This iterator does not point to any valid element, and therefore should not be dereferenced. If the array is empty, the returned iterator is the same as begin().

Returns
An iterator pointing past the last element in the array.

Definition at line 403 of file Array.h.

◆ end() [2/2]

template<typename T >
iterator Amino::Array< T >::end ( )
inlinenoexcept

Get a iterator pointing to the element just past the last element in the array (past-the-end element).

Unlike back(), which returns a reference to the last element in the array, this function returns a random-access iterator pointing past the last element. This iterator does not point to any valid element, and therefore should not be dereferenced. If the array is empty, the returned iterator is the same as begin().

Returns
An iterator pointing past the last element in the array.

Definition at line 402 of file Array.h.

◆ erase() [1/2]

template<typename T >
iterator Amino::Array< T >::erase ( const_iterator  first,
const_iterator  last 
)
inline

Removes the elements in the range [first,last) from the container.

Parameters
firstbeginning of range to remove
lastend of range to remove
Returns
Iterator following the last removed element. If the iterator pos refers to the last element, the end() iterator is returned.

Definition at line 543 of file Array.h.

◆ erase() [2/2]

template<typename T >
iterator Amino::Array< T >::erase ( const_iterator  pos)
inline

Removes the element at pos from the container.

Parameters
positerator to the element to remove. Must be valid and dereferenceable
Returns
Iterator following the last removed element. If the iterator pos refers to the last element, the end() iterator is returned.

Definition at line 532 of file Array.h.

◆ front() [1/2]

template<typename T >
reference Amino::Array< T >::front ( )
inline

Get a reference to the first element in the array.

Unlike begin(), which returns an iterator to the first element in the array, this function returns a direct reference to the first element.

Precondition
!empty()
Returns
A reference to the first element in the array.

Definition at line 350 of file Array.h.

◆ front() [2/2]

template<typename T >
const_reference Amino::Array< T >::front ( ) const
inline

Get a reference to the first element in the array.

Unlike begin(), which returns an iterator to the first element in the array, this function returns a direct reference to the first element.

Precondition
!empty()
Returns
A reference to the first element in the array.

Definition at line 351 of file Array.h.

◆ insert() [1/5]

template<typename T >
iterator Amino::Array< T >::insert ( const_iterator  pos,
const value_type value 
)
inline

Inserts value before pos.

Parameters
positerator before which the content will be inserted. pos may be the end() iterator
valueelement value to insert
Returns
Iterator pointing to the inserted value

Definition at line 465 of file Array.h.

◆ insert() [2/5]

template<typename T >
template<class InputIterator , typename = enable_if_input_iterator_t<InputIterator>>
iterator Amino::Array< T >::insert ( const_iterator  pos,
InputIterator  first,
InputIterator  last 
)
inline

Inserts elements from range [first,last) before pos.

Parameters
positerator before which the content will be inserted. pos may be the end() iterator
firstiterator to first element to insert
lastend iterator of range to insert
Warning
first and last can't be iterators into container for which insert is called
Precondition
(begin() <= pos && pos <= end())
!(begin() <= first && first <= end())
!(begin() <= last && last <= end())
Returns
Iterator pointing to the first element inserted, or pos if first==last.

Definition at line 506 of file Array.h.

◆ insert() [3/5]

template<typename T >
iterator Amino::Array< T >::insert ( const_iterator  pos,
size_type  count,
const value_type value 
)
inline

Inserts count copies of the value before pos.

Parameters
positerator before which the content will be inserted. pos may be the end() iterator
countnumber of copies to make
valueelement value to copy
Returns
Iterator pointing to the first element inserted, or pos if count==0.

Definition at line 482 of file Array.h.

◆ insert() [4/5]

template<typename T >
iterator Amino::Array< T >::insert ( const_iterator  pos,
std::initializer_list< value_type init 
)
inline

inserts elements from initializer list init before pos.

Parameters
positerator before which the content will be inserted. pos may be the end() iterator
initinitializer list to insert the values from
Returns
Iterator pointing to the first element inserted, or pos if init is empty.

Definition at line 520 of file Array.h.

◆ insert() [5/5]

template<typename T >
iterator Amino::Array< T >::insert ( const_iterator  pos,
value_type &&  value 
)
inline

Inserts value before pos.

Parameters
positerator before which the content will be inserted. pos may be the end() iterator
valueelement value to insert
Returns
Iterator pointing to the inserted value

Definition at line 468 of file Array.h.

◆ max_size()

template<typename T >
size_type Amino::Array< T >::max_size ( ) const
inline

Return the maximum number of elements the array is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest possible container.

Note
This value typically reflects the theoretical limit on the size of the container, at most std::numeric_limits<difference_type>::max(). At runtime, the size of the container may be limited to a value smaller than max_size() by the amount of RAM available.
Returns
The theoretical maximum number of elements the array can hold.

Definition at line 429 of file Array.h.

◆ operator=() [1/3]

template<typename T >
Array< T > & Amino::Array< T >::operator= ( Array< T > &&  other)
defaultnoexcept

Move assignment operator.

Take ownership of all the elements of other into the current array. Any elements held in the current array before this call are destroyed.

Parameters
otherAn array of the same type.

◆ operator=() [2/3]

template<typename T >
Array< T > & Amino::Array< T >::operator= ( const Array< T > &  other)
default

Copy assignment operator.

Copy all the elements from other into the current array. Any elements held in the current array before this call are destroyed.

Parameters
otherAn array of the same type.

◆ operator=() [3/3]

template<typename T >
Array< T > & Amino::Array< T >::operator= ( std::initializer_list< value_type init)
inline

Copy all the elements from init into the current array.

Any elements held in the current array before this call are destroyed.

Parameters
initAn initializer list.

Definition at line 250 of file Array.h.

◆ operator[]() [1/2]

template<typename T >
reference Amino::Array< T >::operator[] ( size_type  n)
inline

Get a reference to the element at position n in the array.

Precondition
n < size()
Parameters
nThe index of the element in the array.
Returns
A reference to the element at position n in the array.

Definition at line 335 of file Array.h.

◆ operator[]() [2/2]

template<typename T >
const_reference Amino::Array< T >::operator[] ( size_type  n) const
inline

Get a reference to the element at position n in the array.

Precondition
n < size()
Parameters
nThe index of the element in the array.
Returns
A reference to the element at position n in the array.

Definition at line 336 of file Array.h.

◆ pop_back()

template<typename T >
void Amino::Array< T >::pop_back ( )
inline

Removes the last element of the container.

Precondition
!empty()
Note
Calling pop_back on an empty container is undefined.

Definition at line 570 of file Array.h.

◆ push_back() [1/2]

template<typename T >
void Amino::Array< T >::push_back ( const value_type value)
inline

Appends the given element value to the end of the container.

Definition at line 549 of file Array.h.

◆ push_back() [2/2]

template<typename T >
void Amino::Array< T >::push_back ( value_type &&  value)
inline

Appends the given element value to the end of the container.

Definition at line 550 of file Array.h.

◆ reserve()

template<typename T >
void Amino::Array< T >::reserve ( size_type  new_capacity)
inline

Increase the capacity of the array to a value that's greater or equal to new_capacity.

If new_capacity is greater than the current capacity(), new storage is allocated and elements are moved the that new storage, otherwise the method does nothing.

Parameters
new_capacityThe new capacity of the array.

Definition at line 439 of file Array.h.

◆ resize() [1/2]

template<typename T >
void Amino::Array< T >::resize ( size_type  count)
inline

Resizes the container to contain count elements.

If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, additional default elements are appended.

Postcondition
size() == count
Parameters
countnew size of the container.

Definition at line 581 of file Array.h.

◆ resize() [2/2]

template<typename T >
void Amino::Array< T >::resize ( size_type  count,
const value_type value 
)
inline

Resizes the container to contain count elements.

If the current size is greater than count, the container is reduced to its first count elements. If the current size is less than count, additional copies of value are appended.

Postcondition
size() == count
Parameters
countnew size of the container.
valuethe value to initialize the new elements with.

Definition at line 593 of file Array.h.

◆ shrink_to_fit()

template<typename T >
void Amino::Array< T >::shrink_to_fit ( )
inlinenoexcept

Requests the removal of unused capacity.

Definition at line 449 of file Array.h.

◆ size()

template<typename T >
size_type Amino::Array< T >::size ( ) const
inlinenoexcept

Get the number of elements in the array.

Returns
The number of elements in the array.

Definition at line 417 of file Array.h.

◆ swap()

template<typename T >
void Amino::Array< T >::swap ( Array< T > &  other)
inlinenoexcept

Exchange the content of the array by the content of other, which is another array object containing elements of the same type.

Array sizes can be different.

After a call to this function, the elements in this array are those which were in other before the call, and the elements of other are those which were in this array. All iterators, references and pointers remain valid for the swapped arrays.

Parameters
otherAn array of the same type the swap with.

Definition at line 608 of file Array.h.

References Amino::swap().