36template <
typename T,
size_t Extent = std::dynamic_extent>
49 static constexpr size_t extent = Extent;
54 requires(Extent ==
std::dynamic_extent || Extent == 0)
61 template <std::contiguous_iterator It>
62 constexpr explicit(
extent != std::dynamic_extent)
66 template <std::contiguous_iterator It, std::sized_sentinel_for<It> End>
67 requires(!std::is_convertible_v<End, size_type>)
68 constexpr explicit(
extent != std::dynamic_extent)
74 template <
size_t ArrayExtent>
75 requires(Extent == std::dynamic_extent || ArrayExtent == Extent)
77 std::type_identity_t<element_type> (&arr)[ArrayExtent],
78 int rotation = 0) noexcept
81 template <
typename Tp,
size_t ArrayExtent>
86 template <
typename Tp,
size_t ArrayExtent>
91 template <
typename OType,
size_t OExtent>
92 requires(Extent == std::dynamic_extent || OExtent == std::dynamic_extent ||
94 constexpr explicit(
extent != std::dynamic_extent &&
95 OExtent == std::dynamic_extent)
98 : m_data{
other.m_data},
101 template <
typename OType,
size_t OExtent>
102 requires(Extent == std::dynamic_extent || OExtent == std::dynamic_extent ||
104 constexpr explicit(extent != std::dynamic_extent &&
107 : m_data{other.m_data}, m_offset{other.m_offset} {}
123 return m_data.size_bytes();
137 return m_data[(
m_offset + m_data.size() - 1) % m_data.size()];
142 return m_data[(
m_offset + idx) % m_data.size()];
156 : m_obj{obj}, m_idx{idx} {}
204 std::span<T, Extent> m_data;
207 static constexpr size_type MakeOffset(
size_t size,
int rotation) {
212 return rotation % size;
218 return size - (-rotation % size);
225template <
typename Type,
size_t ArrayExtent>
228template <
typename Type,
size_t ArrayExtent>
231template <std::contiguous_iterator It,
typename End>
235template <
typename Type,
size_t Extent>
237inline rotated_span<
const std::byte, Extent == std::dynamic_extent
238 ? std::dynamic_extent
239 : Extent *
sizeof(Type)>
241 return {std::as_bytes(sp.
data()), sp.
offset() *
sizeof(Type)};
244template <
typename Type,
size_t Extent>
245 requires(!std::is_const_v<Type>)
247inline rotated_span<std::byte, Extent == std::dynamic_extent
248 ? std::dynamic_extent
249 : Extent * sizeof(Type)>
Definition rotated_span.hpp:147
rotated_span::value_type value_type
Definition rotated_span.hpp:150
constexpr reference operator*()
Definition rotated_span.hpp:168
rotated_span::reference reference
Definition rotated_span.hpp:153
constexpr iterator(const rotated_span *obj, size_type idx) noexcept
Definition rotated_span.hpp:155
std::forward_iterator_tag iterator_category
Definition rotated_span.hpp:149
constexpr bool operator==(const iterator &) const =default
rotated_span::difference_type difference_type
Definition rotated_span.hpp:151
rotated_span::pointer pointer
Definition rotated_span.hpp:152
constexpr iterator & operator++() noexcept
Definition rotated_span.hpp:158
constexpr iterator operator++(int) noexcept
Definition rotated_span.hpp:162
This is a simple rotated span view.
Definition rotated_span.hpp:37
std::reverse_iterator< iterator > reverse_iterator
Definition rotated_span.hpp:175
constexpr size_type size() const noexcept
Definition rotated_span.hpp:120
const element_type & const_reference
Definition rotated_span.hpp:46
constexpr rotated_span() noexcept=default
const T * const_pointer
Definition rotated_span.hpp:44
std::remove_cv_t< T > value_type
Definition rotated_span.hpp:40
constexpr rotated_span(const std::array< Tp, ArrayExtent > &arr, int rotation=0) noexcept
Definition rotated_span.hpp:87
constexpr OExtent int rotation noexcept
Definition rotated_span.hpp:98
constexpr reference operator[](size_type idx) const noexcept
Definition rotated_span.hpp:141
constexpr rotated_span rotate(int amt) const noexcept
Definition rotated_span.hpp:199
std::ptrdiff_t difference_type
Definition rotated_span.hpp:42
static constexpr size_t extent
Definition rotated_span.hpp:49
constexpr rotated_span(rotated_span &&) noexcept=default
constexpr iterator begin() const noexcept
Definition rotated_span.hpp:178
constexpr OExtent & other
Definition rotated_span.hpp:96
constexpr reference front() const noexcept
Definition rotated_span.hpp:131
constexpr reverse_iterator rbegin() const noexcept
Definition rotated_span.hpp:188
element_type & reference
Definition rotated_span.hpp:45
constexpr size_type offset() const noexcept
Definition rotated_span.hpp:118
constexpr size_type int std::sized_sentinel_for< It > End constexpr End int size_t ArrayExtent constexpr rotated_span(std::array< Tp, ArrayExtent > &arr, int rotation=0) noexcept
Definition rotated_span.hpp:82
constexpr reverse_iterator rend() const noexcept
Definition rotated_span.hpp:193
constexpr bool empty() const noexcept
Definition rotated_span.hpp:126
constexpr size_type count
Definition rotated_span.hpp:63
constexpr iterator end() const noexcept
Definition rotated_span.hpp:183
constexpr size_type int std::sized_sentinel_for< It > End constexpr End last
Definition rotated_span.hpp:69
constexpr OExtent int rotation m_offset
Definition rotated_span.hpp:99
constexpr reference back() const noexcept
Definition rotated_span.hpp:136
constexpr std::span< T, Extent > data() const noexcept
Definition rotated_span.hpp:116
constexpr size_type int rotation
Definition rotated_span.hpp:63
T element_type
Definition rotated_span.hpp:39
T * pointer
Definition rotated_span.hpp:43
constexpr size_type size_bytes() const noexcept
Definition rotated_span.hpp:122
size_t size_type
Definition rotated_span.hpp:41
Definition StringMap.hpp:773
Definition raw_os_ostream.hpp:19
rotated_span< std::byte, Extent==std::dynamic_extent ? std::dynamic_extent :Extent *sizeof(Type)> as_writable_bytes(rotated_span< Type, Extent > sp) noexcept
Definition rotated_span.hpp:250
rotated_span(Type(&)[ArrayExtent]) -> rotated_span< Type, ArrayExtent >
rotated_span< const std::byte, Extent==std::dynamic_extent ? std::dynamic_extent :Extent *sizeof(Type)> as_bytes(rotated_span< Type, Extent > sp) noexcept
Definition rotated_span.hpp:240