![]() |
ufe 7.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
|
Array is a container class that encapsulates dynamic sized arrays. More...
#include <array.h>
Public Types | |
| typedef T | value_type |
| typedef T & | reference |
| typedef const T & | const_reference |
| typedef T * | pointer |
| typedef const T * | const_pointer |
| using | iterator = T * |
| using | const_iterator = const T * |
| typedef std::reverse_iterator< iterator > | reverse_iterator |
| typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
| using | size_type = std::size_t |
Public Member Functions | |
Constructors and Destructor | |
| Array () | |
| Default constructor. Creates an empty Array. More... | |
| Array (const Array &) | |
| Copy constructor. More... | |
| Array (size_type count) | |
Constructs an array with count default-inserted objects of T. More... | |
| Array (size_type count, const value_type &value) | |
Constructs an array with count copies of elements with value value. More... | |
| Array (std::initializer_list< value_type > il) | |
| Initializer list constructor. More... | |
| template<typename InputIt > | |
| Array (InputIt first, InputIt last) | |
| Range constructor. Creates a Array with elements from the range [first, last). More... | |
| Array (Array &&) noexcept | |
| Move constructor. More... | |
| ~Array () | |
| Destructor. More... | |
Assignment Operators | |
| Array & | operator= (const Array &other) |
| Copy assignment operator. More... | |
| Array & | operator= (Array &&other) noexcept |
| Move assignment operator. More... | |
| Array & | operator= (std::initializer_list< value_type > il) |
| Initializer list assignment operator. More... | |
Iterators | |
| iterator | begin () |
| Returns an iterator to the first element of the array. More... | |
| const_iterator | begin () const |
| Returns a constant iterator to the first element of the array. More... | |
| const_iterator | cbegin () const |
| Returns a constant iterator to the first element of the array. More... | |
| iterator | end () |
| Returns an iterator to the element following the last element of the array. More... | |
| const_iterator | end () const |
| Returns a constant iterator to the element following the last element of the array. More... | |
| const_iterator | cend () const |
| Returns a constant iterator to the element following the last element of the array. More... | |
| reverse_iterator | rbegin () |
| Returns a reverse iterator to the end of the array. More... | |
| const_reverse_iterator | rbegin () const |
| Returns a constant reverse iterator to the end of the array. More... | |
| const_reverse_iterator | crbegin () const |
| Returns a constant reverse iterator to the end of the array. More... | |
| reverse_iterator | rend () |
| Returns a reverse iterator to the beginning of the array. More... | |
| const_reverse_iterator | rend () const |
| Returns a constant reverse iterator to the beginning of the array. More... | |
| const_reverse_iterator | crend () const |
| Returns a constant reverse iterator to the beginning of the array. More... | |
Capacity | |
| size_type | size () const |
| Returns the number of elements in the container. More... | |
| size_type | capacity () const |
| Returns the number of elements that can be held in currently allocated storage. More... | |
| bool | empty () const |
| Checks if the array has no elements. More... | |
| void | reserve (size_type n) |
| Requests that the capacity be at least enough to contain n elements. More... | |
Element access | |
| reference | operator[] (size_type n) |
| Returns a reference to the element at specified location n. More... | |
| const_reference | operator[] (size_type n) const |
| Returns a constant reference to the element at specified location n. More... | |
| reference | at (size_type n) |
| Returns a reference to the element at specified location pos, with bounds checking. More... | |
| const_reference | at (size_type n) const |
| Returns a constant reference to the element at specified location pos, with bounds checking. More... | |
| reference | front () |
| Returns a reference to the first element in the array. More... | |
| const_reference | front () const |
| Returns a constant reference to the first element in the array. More... | |
| reference | back () |
| Returns a reference to the last element in the array. More... | |
| const_reference | back () const |
| Returns a constant reference to the last element in the array. More... | |
| value_type * | data () |
| Returns a pointer to this array's data. More... | |
| const value_type * | data () const |
| Returns a const pointer to this array's data. More... | |
Modifiers | |
| void | assign (size_type n, const value_type &val) |
Replaces the contents with n copies of val. More... | |
| template<typename InputIt > | |
| void | assign (InputIt first, InputIt last) |
| Replaces the contents with copies of the elements in the range [first, last). More... | |
| void | assign (std::initializer_list< value_type > il) |
Replaces the contents with copies of the elements in the initializer list il. More... | |
| void | push_back (const value_type &val) |
| Appends an element to the end of the array. More... | |
| void | push_back (value_type &&val) |
| Appends an element to the end of the array. More... | |
| void | pop_back () |
| Removes the last element of the array. More... | |
| iterator | insert (const_iterator position, const value_type &val) |
Inserts a copy of val before the element at the specified position position. More... | |
| iterator | insert (const_iterator position, value_type &&val) |
Inserts val before the element at the specified position position possibly moving it. More... | |
| iterator | insert (const_iterator position, size_type n, const value_type &val) |
Inserts n copies of val before the element at the specified position position. More... | |
| template<class InputIt > | |
| std::enable_if_t<!std::is_integral_v< InputIt >, iterator > | insert (const_iterator position, InputIt first, InputIt last) |
Inserts copies of the elements in the range [first, last) before the element at the specified position position. More... | |
| iterator | insert (const_iterator position, std::initializer_list< value_type > il) |
Inserts copies of the elements in the initializer list il before the element at the specified position position. More... | |
| iterator | erase (iterator position) |
Removes the element at the specified position position. More... | |
| iterator | erase (const_iterator position) |
Removes the element at the specified position position. More... | |
| iterator | erase (iterator first, iterator last) |
| Removes the elements in the range [first, last). More... | |
| iterator | erase (const_iterator first, const_iterator last) |
| Removes the elements in the range [first, last). More... | |
| void | swap (Array &other) |
Exchanges the contents and capacity of the array with those of other. More... | |
| void | resize (size_type count) |
Resizes the array to contain count elements. More... | |
| void | resize (size_type count, const value_type &value) |
Resizes the array to contain count elements. More... | |
| void | clear () |
| Removes all elements from the array. The array will be empty after this call. More... | |
| template<typename... Args> | |
| iterator | emplace (const_iterator position, Args &&... args) |
Constructs a new element in-place at the specified position position. More... | |
| template<typename... Args> | |
| void | emplace_back (Args &&... args) |
| Constructs a new element in-place at the end of the array. More... | |
Comparison Operators | |
| bool | operator== (const Array &other) const |
| bool | operator!= (const Array &other) const |
| bool | operator< (const Array &other) const |
| bool | operator<= (const Array &other) const |
| bool | operator> (const Array &other) const |
| bool | operator>= (const Array &other) const |
Private Attributes | |
| std::unique_ptr< Imp > | _imp |
Array is a container class that encapsulates dynamic sized arrays.
Arrays use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to its elements. Their size can change dynamically, with their storage being handled automatically by the container.
Array is a template class that wraps std::vector functionality using the PIMPL (Pointer to Implementation) idiom. All operations are forwarded to the hidden internal implementation.
This class is instantiated for the following types:
bool int unsigned int float double string Ufe::Vector2i Ufe::Vector2f Ufe::Vector2d Ufe::Vector3i Ufe::Vector3f Ufe::Vector3d Ufe::Vector4i Ufe::Vector4f Ufe::Vector4d Ufe::Color3f Ufe::Color4f Ufe::Matrix3d Ufe::Matrix4d | using Ufe::Array< T >::const_iterator = const T* |
| typedef const T* Ufe::Array< T >::const_pointer |
| typedef const T& Ufe::Array< T >::const_reference |
| typedef std::reverse_iterator<const_iterator> Ufe::Array< T >::const_reverse_iterator |
| using Ufe::Array< T >::iterator = T* |
| typedef T* Ufe::Array< T >::pointer |
| typedef T& Ufe::Array< T >::reference |
| typedef std::reverse_iterator<iterator> Ufe::Array< T >::reverse_iterator |
| using Ufe::Array< T >::size_type = std::size_t |
| typedef T Ufe::Array< T >::value_type |
| Ufe::Array< T >::Array | ( | ) |
Default constructor. Creates an empty Array.
| Ufe::Array< T >::Array | ( | const Array< T > & | ) |
Copy constructor.
|
explicit |
Constructs an array with count default-inserted objects of T.
|
explicit |
Constructs an array with count copies of elements with value value.
| Ufe::Array< T >::Array | ( | std::initializer_list< value_type > | il | ) |
Initializer list constructor.
|
inline |
|
noexcept |
Move constructor.
| Ufe::Array< T >::~Array | ( | ) |
Destructor.
|
inline |
| void Ufe::Array< T >::assign | ( | size_type | n, |
| const value_type & | val | ||
| ) |
Replaces the contents with n copies of val.
| void Ufe::Array< T >::assign | ( | std::initializer_list< value_type > | il | ) |
Replaces the contents with copies of the elements in the initializer list il.
| reference Ufe::Array< T >::at | ( | size_type | n | ) |
Returns a reference to the element at specified location pos, with bounds checking.
| std::out_of_range | If pos is not within the range of the array. |
| [in] | n | Position of the element to return. |
| const_reference Ufe::Array< T >::at | ( | size_type | n | ) | const |
Returns a constant reference to the element at specified location pos, with bounds checking.
| std::out_of_range | If pos is not within the range of the array. |
| [in] | n | Position of the element to return. |
| reference Ufe::Array< T >::back | ( | ) |
Returns a reference to the last element in the array.
| const_reference Ufe::Array< T >::back | ( | ) | const |
Returns a constant reference to the last element in the array.
| iterator Ufe::Array< T >::begin | ( | ) |
Returns an iterator to the first element of the array.
| const_iterator Ufe::Array< T >::begin | ( | ) | const |
Returns a constant iterator to the first element of the array.
| size_type Ufe::Array< T >::capacity | ( | ) | const |
Returns the number of elements that can be held in currently allocated storage.
|
inline |
|
inline |
| void Ufe::Array< T >::clear | ( | ) |
Removes all elements from the array. The array will be empty after this call.
|
inline |
|
inline |
| value_type * Ufe::Array< T >::data | ( | ) |
Returns a pointer to this array's data.
| const value_type * Ufe::Array< T >::data | ( | ) | const |
Returns a const pointer to this array's data.
| iterator Ufe::Array< T >::emplace | ( | const_iterator | position, |
| Args &&... | args | ||
| ) |
Constructs a new element in-place at the specified position position.
| void Ufe::Array< T >::emplace_back | ( | Args &&... | args | ) |
Constructs a new element in-place at the end of the array.
| bool Ufe::Array< T >::empty | ( | ) | const |
Checks if the array has no elements.
| iterator Ufe::Array< T >::end | ( | ) |
Returns an iterator to the element following the last element of the array.
| const_iterator Ufe::Array< T >::end | ( | ) | const |
Returns a constant iterator to the element following the last element of the array.
| iterator Ufe::Array< T >::erase | ( | const_iterator | first, |
| const_iterator | last | ||
| ) |
Removes the elements in the range [first, last).
| iterator Ufe::Array< T >::erase | ( | const_iterator | position | ) |
Removes the element at the specified position position.
| iterator Ufe::Array< T >::erase | ( | iterator | first, |
| iterator | last | ||
| ) |
Removes the elements in the range [first, last).
| iterator Ufe::Array< T >::erase | ( | iterator | position | ) |
Removes the element at the specified position position.
| reference Ufe::Array< T >::front | ( | ) |
Returns a reference to the first element in the array.
| const_reference Ufe::Array< T >::front | ( | ) | const |
Returns a constant reference to the first element in the array.
| iterator Ufe::Array< T >::insert | ( | const_iterator | position, |
| const value_type & | val | ||
| ) |
Inserts a copy of val before the element at the specified position position.
|
inline |
| iterator Ufe::Array< T >::insert | ( | const_iterator | position, |
| size_type | n, | ||
| const value_type & | val | ||
| ) |
Inserts n copies of val before the element at the specified position position.
| iterator Ufe::Array< T >::insert | ( | const_iterator | position, |
| std::initializer_list< value_type > | il | ||
| ) |
Inserts copies of the elements in the initializer list il before the element at the specified position position.
| iterator Ufe::Array< T >::insert | ( | const_iterator | position, |
| value_type && | val | ||
| ) |
Inserts val before the element at the specified position position possibly moving it.
| bool Ufe::Array< T >::operator!= | ( | const Array< T > & | other | ) | const |
| bool Ufe::Array< T >::operator< | ( | const Array< T > & | other | ) | const |
| bool Ufe::Array< T >::operator<= | ( | const Array< T > & | other | ) | const |
|
noexcept |
Move assignment operator.
| Array & Ufe::Array< T >::operator= | ( | const Array< T > & | other | ) |
Copy assignment operator.
| Array & Ufe::Array< T >::operator= | ( | std::initializer_list< value_type > | il | ) |
Initializer list assignment operator.
| bool Ufe::Array< T >::operator== | ( | const Array< T > & | other | ) | const |
| bool Ufe::Array< T >::operator> | ( | const Array< T > & | other | ) | const |
| bool Ufe::Array< T >::operator>= | ( | const Array< T > & | other | ) | const |
| reference Ufe::Array< T >::operator[] | ( | size_type | n | ) |
Returns a reference to the element at specified location n.
| const_reference Ufe::Array< T >::operator[] | ( | size_type | n | ) | const |
Returns a constant reference to the element at specified location n.
| void Ufe::Array< T >::pop_back | ( | ) |
Removes the last element of the array.
| void Ufe::Array< T >::push_back | ( | const value_type & | val | ) |
Appends an element to the end of the array.
| void Ufe::Array< T >::push_back | ( | value_type && | val | ) |
Appends an element to the end of the array.
|
inline |
|
inline |
|
inline |
|
inline |
| void Ufe::Array< T >::reserve | ( | size_type | n | ) |
Requests that the capacity be at least enough to contain n elements.
n is greater than the current capacity(), new storage is allocated, otherwise the function does nothing. | void Ufe::Array< T >::resize | ( | size_type | count | ) |
Resizes the array to contain count elements.
count is equal to current size, does nothing. count, the array is reduced to its first count elements. count, additional default-inserted elements are appended. | void Ufe::Array< T >::resize | ( | size_type | count, |
| const value_type & | value | ||
| ) |
Resizes the array to contain count elements.
count is equal to current size, does nothing. count, the array is reduced to its first count elements. count, additional copies of value are appended. | size_type Ufe::Array< T >::size | ( | ) | const |
Returns the number of elements in the container.
| void Ufe::Array< T >::swap | ( | Array< T > & | other | ) |
Exchanges the contents and capacity of the array with those of other.
|
private |