#include <bn_array.h>
template<typename Type, int Size>
array class
std::array
like container.
Template parameters | |
---|---|
Type | Element type. |
Size | Number of stored elements. |
It doesn't throw exceptions. Instead, asserts are used to ensure valid usage.
Public types
- using value_type = Type
- Value type alias.
- using size_type = int
- Size type alias.
- using difference_type = int
- Difference type alias.
- using reference = Type&
- Reference alias.
- using const_reference = const Type&
- Const reference alias.
- using pointer = Type*
- Pointer alias.
- using const_pointer = const Type*
- Const pointer alias.
- using iterator = Type*
- Iterator alias.
- using const_iterator = const Type*
- Const iterator alias.
- using reverse_iterator = bn::reverse_iterator<iterator>
- Reverse iterator alias.
-
using const_reverse_iterator = bn::reverse_iterator<const_
iterator> - Const reverse iterator alias.
Public functions
-
auto data() const -> const_
pointer constexpr - Returns a const pointer to the beginning of the array.
- auto data() -> pointer constexpr
- Returns a pointer to the beginning of the array.
-
auto size() const -> size_
type constexpr - Returns the elements count.
-
auto max_size() const -> size_
type constexpr - Returns the maximum possible elements count.
-
auto available() const -> size_
type constexpr - Returns the remaining element capacity.
- auto empty() const -> bool constexpr
- Indicates if it doesn't contain any element.
- auto full() const -> bool constexpr
- Indicates if it can't contain any more elements.
-
auto begin() const -> const_
iterator constexpr - Returns a const iterator to the beginning of the array.
- auto begin() -> iterator constexpr
- Returns an iterator to the beginning of the array.
-
auto end() const -> const_
iterator constexpr - Returns a const iterator to the end of the array.
- auto end() -> iterator constexpr
- Returns an iterator to the end of the array.
-
auto cbegin() const -> const_
iterator constexpr - Returns a const iterator to the beginning of the array.
-
auto cend() const -> const_
iterator constexpr - Returns a const iterator to the end of the array.
-
auto rbegin() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the end of the array.
-
auto rbegin() -> reverse_
iterator constexpr - Returns a reverse iterator to the end of the array.
-
auto rend() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the beginning of the array.
-
auto rend() -> reverse_
iterator constexpr - Returns a reverse iterator to the beginning of the array.
-
auto crbegin() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the end of the array.
-
auto crend() const -> const_
reverse_ iterator constexpr - Returns a const reverse iterator to the beginning of the array.
-
auto operator[](size_
type index) const -> const_ reference constexpr - Returns a const reference to the value stored at the specified index.
-
auto operator[](size_
type index) -> reference constexpr - Returns a reference to the value stored at the specified index.
-
auto at(size_
type index) const -> const_ reference constexpr - Returns a const reference to the value stored at the specified index.
-
auto at(size_
type index) -> reference constexpr - Returns a reference to the value stored at the specified index.
-
auto front() const -> const_
reference constexpr - Returns a const reference to the first element.
- auto front() -> reference constexpr
- Returns a reference to the first element.
-
auto back() const -> const_
reference constexpr - Returns a const reference to the last element.
- auto back() -> reference constexpr
- Returns a reference to the last element.
-
void fill(const_
reference value) constexpr - Fills the array with the given value.
- void swap(array& other) constexpr
- Exchanges the contents of this array with those of the other one.
Public variables
- Type _data
- (Not so) internal data.
Friends
- void swap(array& a, array& b) constexpr
- Exchanges the contents of an array with those of another one.
- auto operator==(const array& a, const array& b) -> bool constexpr
- Equal operator.
- auto operator<(const array& a, const array& b) -> bool constexpr
- Less than operator.
- auto operator>(const array& a, const array& b) -> bool constexpr
- Greater than operator.
- auto operator<=(const array& a, const array& b) -> bool constexpr
- Less than or equal operator.
- auto operator>=(const array& a, const array& b) -> bool constexpr
- Greater than or equal operator.
Function documentation
template<typename Type, int Size>
bool operator==(const array& a,
const array& b) constexpr
Equal operator.
Parameters | |
---|---|
a | First array to compare. |
b | Second array to compare. |
Returns | true if the first array is equal to the second one, otherwise false . |
template<typename Type, int Size>
bool operator<=(const array& a,
const array& b) constexpr
Less than or equal operator.
Parameters | |
---|---|
a | First array to compare. |
b | Second array to compare. |
Returns | true if the first array is lexicographically less than or equal to the second one, otherwise false . |
template<typename Type, int Size>
bool operator>=(const array& a,
const array& b) constexpr
Greater than or equal operator.
Parameters | |
---|---|
a | First array to compare. |
b | Second array to compare. |
Returns | true if the first array is lexicographically greater than or equal to the second one, otherwise false . |