16 std::size_t size_ = 0;
21 using element_type = T;
25 using value_type =
typename std::remove_const<T>::type;
29 using index_type = std::ptrdiff_t;
41 using iterator = pointer;
45 using const_pointer = T
const*;
49 using const_reference = T
const&;
53 using const_iterator = const_pointer;
65 Span& operator=(
Span const&) =
default;
72 : data_(data), size_(size)
79 template<
class ContiguousContainer>
80 Span(ContiguousContainer&& container)
81 : data_(container.
data())
82 , size_(container.
size())
89 template<
class ContiguousContainer>
91 data_ = container.data();
92 size_ = container.size();
101 assert(index < size_);
110 assert(index < size_);
176 return data_ + size_;
183 return data_ + size_;
190 return data_ + size_;
Span(ContiguousContainer &&container)
Constructor by contiguous container.
Definition: Span.h:80
bool empty() const
Returns true if the span is empty.
Definition: Span.h:117
const_iterator begin() const
Returns an const iterator to the beginning of the span.
Definition: Span.h:161
reference operator[](std::size_t index)
Square brackets operator for convenient acces to underlying array; param index Array index...
Definition: Span.h:100
pointer data() const
Returns a pointer to the beginning of the span.
Definition: Span.h:124
Span & operator=(ContiguousContainer &&container)
Assignment operator with contiguous container.
Definition: Span.h:90
std::size_t size() const
Returns the number of elements in the span.
Definition: Span.h:131
Span(T *data, std::size_t size)
Constructor by pointer and size.
Definition: Span.h:71
const_iterator cend() const
Returns an const iterator to one past the end of the span.
Definition: Span.h:189
iterator begin()
Returns an iterator to the beginning of the span.
Definition: Span.h:154
std::size_t getSize() const
Returns the number of elements in the span.
Definition: Span.h:138
const_iterator cbegin() const
Returns an iterator to the beginning of the span.
Definition: Span.h:168
const_iterator end() const
Returns an const iterator to one past the end of the span.
Definition: Span.h:182
const_reference operator[](std::size_t index) const
Non-modifying square brackets operator for convenient acces to underlying array; param index Array in...
Definition: Span.h:109
iterator end()
Returns an iterator to one past the end of the span.
Definition: Span.h:175
void setSize(std::size_t size)
Sets the number of elements in the span. Because the span is not owning, this method will no constru...
Definition: Span.h:147
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:13