17 std::size_t size_ = 0;
22 using element_type = T;
26 using value_type =
typename std::remove_const<T>::type;
30 using index_type = std::ptrdiff_t;
42 using iterator = pointer;
46 using const_pointer = T
const*;
50 using const_reference = T
const&;
54 using const_iterator = const_pointer;
66 Span& operator=(
Span const&) =
default;
73 : data_(data), size_(size)
80 template<
class ContiguousContainer>
81 Span(ContiguousContainer&& container)
82 : data_(container.
data())
83 , size_(container.
size())
90 template<
class ContiguousContainer>
92 data_ = container.data();
93 size_ = container.size();
102 assert(index < size_);
111 assert(index < size_);
177 return data_ + size_;
184 return data_ + size_;
191 return data_ + size_;
Span(ContiguousContainer &&container)
Constructor by contiguous container.
Definition: Span.h:81
bool empty() const
Returns true if the span is empty.
Definition: Span.h:118
const_iterator begin() const
Returns an const iterator to the beginning of the span.
Definition: Span.h:162
reference operator[](std::size_t index)
Square brackets operator for convenient acces to underlying array; param index Array index...
Definition: Span.h:101
pointer data() const
Returns a pointer to the beginning of the span.
Definition: Span.h:125
Span & operator=(ContiguousContainer &&container)
Assignment operator with contiguous container.
Definition: Span.h:91
std::size_t size() const
Returns the number of elements in the span.
Definition: Span.h:132
Span(T *data, std::size_t size)
Constructor by pointer and size.
Definition: Span.h:72
const_iterator cend() const
Returns an const iterator to one past the end of the span.
Definition: Span.h:190
iterator begin()
Returns an iterator to the beginning of the span.
Definition: Span.h:155
std::size_t getSize() const
Returns the number of elements in the span.
Definition: Span.h:139
const_iterator cbegin() const
Returns an iterator to the beginning of the span.
Definition: Span.h:169
const_iterator end() const
Returns an const iterator to one past the end of the span.
Definition: Span.h:183
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:110
iterator end()
Returns an iterator to one past the end of the span.
Definition: Span.h:176
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:148
Span. Not owning data view. It incapsulated pointer to the continuous array with one or more T objec...
Definition: Span.h:14