COMMS
Template library intended to help with implementation of communication protocols.
|
#include "comms/util/ArrayView.h"
Describes an object that can refer to a constant contiguous sequence of other objects.
Provides "view" on the original data.
Public Types | |
using | const_iterator = const_pointer |
Implementation defined constant RandomAccessIterator and ContiguousIterator whose value_type is T. | |
using | const_pointer = const T * |
Pointer to the constant element (const T*) | |
using | const_reference = const T & |
Reference to a const element (const T&) | |
using | const_reverse_iterator = std::reverse_iterator< const_iterator > |
Same as std::reverse_iterator<const_iterator> | |
using | ConstIterator = const_iterator |
Same as const_iterator. | |
using | ConstPointer = const_pointer |
Same as const_pointer. | |
using | ConstReference = const_reference |
Same as const_reference. | |
using | ConstReverseIterator = const_reverse_iterator |
Same as const_reverse_iterator. | |
using | iterator = const_iterator |
Same as const_iterator. | |
using | Iterator = iterator |
Same as iterator. | |
using | pointer = T * |
Pointer to the single element (T*) | |
using | Pointer = pointer |
Same as pointer. | |
using | reference = T & |
Reference to an element (T&) | |
using | Reference = reference |
Same as reference. | |
using | reverse_iterator = const_reverse_iterator |
Same as const_reverse_iterator. | |
using | ReverseIterator = reverse_iterator |
Same as reverse_iterator. | |
using | size_type = std::size_t |
Equal to std::size_t. | |
using | SizeType = size_type |
Same as size_type;. | |
using | value_type = T |
Type of the single element. | |
using | ValueType = value_type |
Same as value_type. | |
Public Member Functions | |
ArrayView () noexcept=default | |
Default constructor. | |
ArrayView (const ArrayView &) noexcept=default | |
Copy constructor. | |
template<std::size_t TN> | |
ArrayView (const T(&data)[TN]) noexcept | |
Construct out of array of elements with known size. | |
ArrayView (const_pointer data, size_type len) noexcept | |
Constructor. | |
template<std::size_t TN> | |
ArrayView (T(&data)[TN]) noexcept | |
Construct out of array of elements with known size. | |
template<typename TIter > | |
ArrayView (TIter iter, size_type len) noexcept | |
Constructor. | |
~ArrayView () noexcept=default | |
Destructor. | |
const_reference | at (size_type pos) const |
Element access with range check. | |
constexpr const_reference | back () const |
Access the last element. | |
constexpr const_iterator | begin () const noexcept |
Iterator to begining of the sequence. | |
constexpr const_iterator | cbegin () const noexcept |
Iterator to begining of the sequence. | |
constexpr const_iterator | cend () const noexcept |
Iterator to the end of the sequence. | |
const_reverse_iterator | crbegin () const noexcept |
Reverse iterator to the end of the sequence. | |
const_reverse_iterator | crend () const noexcept |
Reverse iterator to the beginning of the sequence. | |
constexpr bool | empty () const noexcept |
Check the view is empty. | |
constexpr const_iterator | end () const noexcept |
Iterator to the end of the sequence. | |
constexpr const_reference | front () const |
Access the first element. | |
constexpr size_type | length () const noexcept |
Same as ref size() | |
ArrayView & | operator= (const ArrayView &)=default |
Copy assign. | |
template<std::size_t TN> | |
ArrayView & | operator= (const T(&data)[TN]) |
Assign array of elements with known size. | |
template<std::size_t TN> | |
ArrayView & | operator= (T(&data)[TN]) |
Assign array of elements with known size. | |
constexpr const_reference | operator[] (size_type pos) const |
Element access operator. | |
const_reverse_iterator | rbegin () const noexcept |
Reverse iterator to the end of the sequence. | |
void | remove_prefix (size_type n) |
Narrow the view by skipping number of elements at the beginning. | |
void | remove_suffix (size_type n) |
Narrow the view by dropping number of elements at the end. | |
reverse_iterator | rend () const noexcept |
Reverse iterator to the beginning of the sequence. | |
constexpr size_type | size () const noexcept |
Get number of element in the view. | |
void | swap (ArrayView &other) noexcept |
Swap contents of two views. | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T > | |
bool | operator!= (const ArrayView< T > &view1, const ArrayView< T > &view2) noexcept |
Inequality compare between the views. | |
template<typename T > | |
bool | operator< (const ArrayView< T > &view1, const ArrayView< T > &view2) noexcept |
Lexicographical compare between the views. | |
template<typename T > | |
bool | operator<= (const ArrayView< T > &view1, const ArrayView< T > &view2) noexcept |
Lexicographical compare between the views. | |
template<typename T > | |
bool | operator== (const ArrayView< T > &view1, const ArrayView< T > &view2) noexcept |
Equality compare between the views. | |
template<typename T > | |
bool | operator> (const ArrayView< T > &view1, const ArrayView< T > &view2) noexcept |
Lexicographical compare between the views. | |
template<typename T > | |
bool | operator>= (const ArrayView< T > &view1, const ArrayView< T > &view2) noexcept |
Lexicographical compare between the views. | |
const_reference comms::util::ArrayView< T >::at | ( | size_type | pos | ) | const |
Element access with range check.
Checks the range with COMMS_ASSERT() macro without throwing exception.
|
constexpr |
Access the last element.
|
constexprnoexcept |
Check the view is empty.
|
constexpr |
Access the first element.
void comms::util::ArrayView< T >::remove_prefix | ( | size_type | n | ) |
Narrow the view by skipping number of elements at the beginning.
void comms::util::ArrayView< T >::remove_suffix | ( | size_type | n | ) |
Narrow the view by dropping number of elements at the end.