emlabcpp
modern opinionated embedded C++ library
|
Generic class to represent view of some container. More...
#include <view.h>
Public Types | |
using | value_type = typename std::iterator_traits< Iterator >::value_type |
standard public usings for container More... | |
using | reverse_iterator = std::reverse_iterator< Iterator > |
using | iterator = Iterator |
using | difference_type = typename std::iterator_traits< Iterator >::difference_type |
using | size_type = std::size_t |
Public Member Functions | |
constexpr | view ()=default |
template<range_container_with_iter< iterator > Cont> | |
constexpr | view (Cont &cont) |
constructor from Container, uses begin/end of the container More... | |
template<range_container_with_iter< iterator > Cont> | |
constexpr | view (Cont const &cont) |
constructor from Container, uses begin/end of the container More... | |
template<data_container_with_iter< iterator > Cont> | |
requires (!range_container_with_iter< Cont, iterator >) const expr view(Cont &cont) | |
template<data_container_with_iter< iterator > Cont> | |
requires (!range_container_with_iter< Cont, iterator >) const expr view(Cont const &cont) | |
constexpr | view (Iterator begin, EndIterator end) |
constructor from the iterators that should internally be stored More... | |
template<std::convertible_to< Iterator > OtherIterator, std::convertible_to< EndIterator > OtherEndIterator> | |
constexpr | view (view< OtherIterator, OtherEndIterator > other) |
constexpr Iterator | begin () const |
Start of the dataset iterator. More... | |
constexpr EndIterator | end () const |
Past the end iterator. More... | |
constexpr reverse_iterator | rbegin () const |
Returns iterator to the last element that goes in reverse. More... | |
constexpr reverse_iterator | rend () const |
Returns iterator to the element before first element, that can go in reverse. More... | |
constexpr size_type | size () const |
Size of the view over dataset uses std::ranges::distance() to tell the size. More... | |
constexpr bool | empty () const |
View is empty if both iterators are equal. More... | |
constexpr value_type const & | front () const |
Returns first value of the range. More... | |
constexpr value_type const & | back () const |
Returns last value of the range. More... | |
operator std::span< value_type > () | |
Generic class to represent view of some container.
The view stores iterators to the input container and acts as container.
Note: is_view_v<T> can be used to detect if T is view
using emlabcpp::view< Iterator, EndIterator >::difference_type = typename std::iterator_traits< Iterator >::difference_type |
using emlabcpp::view< Iterator, EndIterator >::iterator = Iterator |
using emlabcpp::view< Iterator, EndIterator >::reverse_iterator = std::reverse_iterator< Iterator > |
using emlabcpp::view< Iterator, EndIterator >::size_type = std::size_t |
using emlabcpp::view< Iterator, EndIterator >::value_type = typename std::iterator_traits< Iterator >::value_type |
standard public usings for container
|
constexprdefault |
|
inlineconstexpr |
constructor from Container, uses begin/end of the container
|
inlineconstexpr |
constructor from Container, uses begin/end of the container
|
inlineconstexpr |
constructor from the iterators that should internally be stored
|
inlineconstexpr |
|
inlineconstexpr |
Returns last value of the range.
|
inlineconstexpr |
Start of the dataset iterator.
|
inlineconstexpr |
View is empty if both iterators are equal.
References emlabcpp::view< Iterator, EndIterator >::begin(), and emlabcpp::view< Iterator, EndIterator >::end().
|
inlineconstexpr |
Past the end iterator.
|
inlineconstexpr |
Returns first value of the range.
|
inline |
|
inlineconstexpr |
Returns iterator to the last element that goes in reverse.
|
inlineconstexpr |
Returns iterator to the element before first element, that can go in reverse.
|
inline |
|
inline |
|
inlineconstexpr |
Size of the view over dataset uses std::ranges::distance() to tell the size.
References emlabcpp::view< Iterator, EndIterator >::begin(), and emlabcpp::view< Iterator, EndIterator >::end().