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;
79 template <
class ContiguousContainer>
80 Span(ContiguousContainer&& container)
81 : data_(container.
data())
82 , size_(container.
size()) {
88 template <
class ContiguousContainer>
90 data_ = container.data();
91 size_ = container.size();
99 assert(index < size_);
107 assert(index < size_);
164 return data_ + size_;
169 const_iterator
end()
const {
170 return data_ + size_;
176 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:113
const_iterator begin() const
Returns an const iterator to the beginning of the span.
Definition: Span.h:151
reference operator[](std::size_t index)
Square brackets operator for convenient acces to underlying array; param index Array index...
Definition: Span.h:98
pointer data() const
Returns a pointer to the beginning of the span.
Definition: Span.h:119
Span & operator=(ContiguousContainer &&container)
Assignment operator with contiguous container.
Definition: Span.h:89
std::size_t size() const
Returns the number of elements in the span.
Definition: Span.h:125
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:175
iterator begin()
Returns an iterator to the beginning of the span.
Definition: Span.h:145
std::size_t getSize() const
Returns the number of elements in the span.
Definition: Span.h:131
const_iterator cbegin() const
Returns an iterator to the beginning of the span.
Definition: Span.h:157
const_iterator end() const
Returns an const iterator to one past the end of the span.
Definition: Span.h:169
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:106
iterator end()
Returns an iterator to one past the end of the span.
Definition: Span.h:163
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:139
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14