|
DSA - Data Structures and Algorithms
|
Implements Array class template for fixed size container. More...
#include <array.h>
Public Types | |
| using | value_type = T |
| Alias for data type used in class. | |
| using | size_type = std::size_t |
| Alias for size type used in class. | |
| using | difference_type = std::ptrdiff_t |
| Alias for pointer difference type. | |
| using | pointer = value_type* |
| Alias for pointer to data type used in class. | |
| using | const_pointer = const value_type* |
| Alias for const pointer to data type used in class. | |
| using | reference = value_type& |
| Alias for reference to data type used in class. | |
| using | const_reference = const value_type& |
| Alias for const reference to data type used in class. | |
| using | iterator = value_type* |
| Alias for iterator to data type used in class. | |
| using | const_iterator = const value_type* |
| Alias for const iterator to data type used in class. | |
| using | reverse_iterator = std::reverse_iterator<iterator> |
| Alias for reverse_iterator to data type used in class. | |
| using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
| Alias for const reverse_iterator to data type used in class. | |
Public Member Functions | |
| constexpr auto | at (size_type pos) -> reference |
Returns a reference to Array element at pos index. If pos is outside of container range, an exception std::out_of_range is thrown. | |
| constexpr auto | at (size_type pos) const -> const_reference |
Returns a const_reference to Array element at pos index. If pos is outside of container range, an exception std::out_of_range is thrown. | |
| constexpr auto | operator[] (size_type pos) -> reference |
Returns a reference to Array element at pos index. If pos is outside of container range, undefined behaviour occurs. | |
| constexpr auto | operator[] (size_type pos) const -> const_reference |
Returns a const_reference to Array element at pos index. If pos is outside of container range, undefined behaviour occurs. | |
| constexpr auto | front () -> reference |
| Returns reference to first Arary element. | |
| constexpr auto | front () const -> const_reference |
| Returns const_reference to first Arary element. | |
| constexpr auto | back () -> reference |
| Returns reference to last Arary element. | |
| constexpr auto | back () const -> const_reference |
| Returns const_reference to last Arary element. | |
| constexpr auto | data () noexcept -> pointer |
| Returns pointer to underlying array container. | |
| constexpr auto | data () const noexcept -> const_pointer |
| Returns const_pointer to underlying array container. | |
| constexpr auto | begin () noexcept -> iterator |
| Returns iterator to first element. | |
| constexpr auto | begin () const noexcept -> const_iterator |
| Returns const_iterator to first element. | |
| constexpr auto | cbegin () const noexcept -> const_iterator |
| Returns const_iterator to first element. | |
| constexpr auto | end () noexcept -> iterator |
| Returns iterator past last element of underlaying array structure. | |
| constexpr auto | end () const noexcept -> const_iterator |
| Returns const_iterator past last element of underlaying array structure. | |
| constexpr auto | cend () const noexcept -> const_iterator |
| Returns const_iterator past last element of underlaying array structure. | |
| constexpr auto | rbegin () noexcept -> reverse_iterator |
| Returns reverse_iterator to the first element of reversed underlaying array structure. | |
| constexpr auto | rbegin () const noexcept -> const_reverse_iterator |
| Returns const_reverse_iterator to the first element of reversed underlaying array structure. | |
| constexpr auto | crbegin () const noexcept -> const_reverse_iterator |
| Returns const_reverse_iterator to the first element of reversed underlaying array structure. | |
| constexpr auto | rend () noexcept -> reverse_iterator |
| Returns reverse_iterator past the last element of reversed underlaying array structure. | |
| constexpr auto | rend () const noexcept -> const_reverse_iterator |
| Returns const_reverse_iterator past the last element of reversed underlaying array structure. | |
| constexpr auto | crend () const noexcept -> const_reverse_iterator |
| Returns const_reverse_iterator past the last element of reversed underlaying array structure. | |
| constexpr auto | empty () const noexcept -> bool |
| Checks if container has elements. | |
| constexpr auto | size () const noexcept -> size_type |
| Returns number of elements in container. | |
| constexpr auto | max_size () const noexcept -> size_type |
| Returns maximum number of elements container can hold. | |
| void | fill (const value_type &value) |
Assigns value to all elements of the container. | |
| constexpr void | swap (Array< T, N > &other) noexcept(std::is_nothrow_swappable_v< T >) |
Exchanges content of current container with other container. | |
Public Attributes | |
| value_type | m_data [N==0 ? 1 :N] {} |
| Underlaying fixed size array containing all elements Conditional size is used to handle zero sized array without template specialization. | |
Implements Array class template for fixed size container.
| T | type of data stored in container |
| N | number of elements in container |
| using dsa::Array< T, N >::const_iterator = const value_type* |
| using dsa::Array< T, N >::const_pointer = const value_type* |
| using dsa::Array< T, N >::const_reference = const value_type& |
| using dsa::Array< T, N >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
Alias for const reverse_iterator to data type used in class.
| using dsa::Array< T, N >::difference_type = std::ptrdiff_t |
| using dsa::Array< T, N >::iterator = value_type* |
| using dsa::Array< T, N >::pointer = value_type* |
| using dsa::Array< T, N >::reference = value_type& |
| using dsa::Array< T, N >::reverse_iterator = std::reverse_iterator<iterator> |
Alias for reverse_iterator to data type used in class.
| using dsa::Array< T, N >::size_type = std::size_t |
| using dsa::Array< T, N >::value_type = T |
|
inlinenodiscardconstexpr |
Returns a reference to Array element at pos index. If pos is outside of container range, an exception std::out_of_range is thrown.
| [in] | pos | index of element to return |
pos index Definition at line 109 of file array.h.
|
inlinenodiscardconstexpr |
Returns a const_reference to Array element at pos index. If pos is outside of container range, an exception std::out_of_range is thrown.
| [in] | pos | index of element to return |
pos index Definition at line 127 of file array.h.
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
Returns const_reference to last Arary element.
|
inlinenodiscardconstexprnoexcept |
Returns const_iterator to first element.
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
Returns const_iterator to first element.
|
inlinenodiscardconstexprnoexcept |
Returns const_iterator past last element of underlaying array structure.
|
inlinenodiscardconstexprnoexcept |
Returns const_reverse_iterator to the first element of reversed underlaying array structure.
Definition at line 329 of file array.h.
|
inlinenodiscardconstexprnoexcept |
Returns const_reverse_iterator past the last element of reversed underlaying array structure.
Definition at line 365 of file array.h.
|
inlinenodiscardconstexprnoexcept |
Returns const_pointer to underlying array container.
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
Returns const_iterator past last element of underlaying array structure.
|
inlinenodiscardconstexprnoexcept |
|
inline |
Assigns value to all elements of the container.
| [in] | value | to assign to all elements of container |
Definition at line 406 of file array.h.
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
Returns const_reference to first Arary element.
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
Returns a const_reference to Array element at pos index. If pos is outside of container range, undefined behaviour occurs.
| [in] | pos | index of element to return |
|
inlinenodiscardconstexprnoexcept |
Returns const_reverse_iterator to the first element of reversed underlaying array structure.
|
inlinenodiscardconstexprnoexcept |
Returns reverse_iterator to the first element of reversed underlaying array structure.
Definition at line 305 of file array.h.
|
inlinenodiscardconstexprnoexcept |
Returns const_reverse_iterator past the last element of reversed underlaying array structure.
|
inlinenodiscardconstexprnoexcept |
Returns reverse_iterator past the last element of reversed underlaying array structure.
|
inlinenodiscardconstexprnoexcept |
|
inlineconstexprnoexcept |
| value_type dsa::Array< T, N >::m_data[N==0 ? 1 :N] {} |