#include <bn_array.h>
template<typename Type, int Size>
bn::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
Not 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>
void bn::array<Type, Size>::swap(array& other) constexpr

Exchanges the contents of this array with those of the other one.

Parameters
other array to exchange the contents with.

template<typename Type, int Size>
void swap(array& a, array& b) constexpr

Exchanges the contents of an array with those of another one.

Parameters
a First array to exchange the contents with.
b Second array to exchange the contents with.

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

Not equal operator.

Parameters
a First array to compare.
b Second array to compare.
Returns true if the first array is not equal to the second one, otherwise false.

template<typename Type, int Size>
bool operator<(const array& a, const array& b) constexpr

Less than operator.

Parameters
a First array to compare.
b Second array to compare.
Returns true if the first array is lexicographically less than the second one, otherwise false.

template<typename Type, int Size>
bool operator>(const array& a, const array& b) constexpr

Greater than operator.

Parameters
a First array to compare.
b Second array to compare.
Returns true if the first array is lexicographically greater than 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.