@@ -86,8 +86,7 @@ namespace hud
8686 */
8787 HD_FORCEINLINE constexpr memory_allocation &operator =(memory_allocation &&other) noexcept
8888 {
89- if (this != &other) [[likely]]
90- {
89+ if (this != &other) [[likely]] {
9190 begin_ptr_ = other.begin_ptr_ ;
9291 other.begin_ptr_ = nullptr ;
9392 end_ptr_ = other.end_ptr_ ;
@@ -128,13 +127,24 @@ namespace hud
128127 {
129128 return begin_ptr_;
130129 }
130+ /* * Retrieves a pointer to the beginning of the sequence. */
131+ [[nodiscard]] HD_FORCEINLINE constexpr const type_t *data_const () const noexcept
132+ {
133+ return begin_ptr_;
134+ }
131135
132136 /* * Retrieves a pointer to the end of the sequence. */
133137 [[nodiscard]] HD_FORCEINLINE constexpr type_t *data_end () const noexcept
134138 {
135139 return end_ptr_;
136140 }
137141
142+ /* * Retrieves a pointer to the end of the sequence. */
143+ [[nodiscard]] HD_FORCEINLINE constexpr const type_t *data_end_const () const noexcept
144+ {
145+ return end_ptr_;
146+ }
147+
138148 /* *
139149 * Retrieves a pointer to the element at the given `index` of the sequence.
140150 * A special case is allowed when `data_at(count())` is called.
@@ -193,23 +203,40 @@ namespace hud
193203 }
194204
195205 /* * Convert the allocation to a slice. */
196- [[nodiscard]] HD_FORCEINLINE constexpr slice<type_t > to_slice () const noexcept
206+ [[nodiscard]] HD_FORCEINLINE constexpr slice<const type_t > as_slice () const noexcept
197207 {
198- return slice (begin_ptr_, count ());
208+ return slice (data_const (), count ());
209+ }
210+ /* * Convert the allocation to a slice. */
211+ [[nodiscard]] HD_FORCEINLINE constexpr slice<type_t > as_slice () noexcept
212+ {
213+ return slice (data (), count ());
199214 }
200215
201- /* * Retrieves an iterator_type to the beginning of the slice . */
202- [[nodiscard]] HD_FORCEINLINE constexpr iterator_type begin () const noexcept
216+ /* * Retrieves an iterator_type to the beginning of the allocation . */
217+ [[nodiscard]] HD_FORCEINLINE constexpr iterator_type begin () noexcept
203218 {
204219 return iterator_type (begin_ptr_);
205220 }
206221
207- /* * Retrieves an iterator_type to the end of the slice. */
208- [[nodiscard]] HD_FORCEINLINE constexpr iterator_type end () const noexcept
222+ /* * Retrieves an const_iterator_type to the beginning of the allocation. */
223+ [[nodiscard]] HD_FORCEINLINE constexpr const_iterator_type begin () const noexcept
224+ {
225+ return const_iterator_type (begin_ptr_);
226+ }
227+
228+ /* * Retrieves an iterator_type to the end of the allocation. */
229+ [[nodiscard]] HD_FORCEINLINE constexpr iterator_type end () noexcept
209230 {
210231 return iterator_type (end_ptr_);
211232 }
212233
234+ /* * Retrieves an const_iterator_type to the end of the allocation. */
235+ [[nodiscard]] HD_FORCEINLINE constexpr const_iterator_type end () const noexcept
236+ {
237+ return const_iterator_type (end_ptr_);
238+ }
239+
213240 private:
214241 memory_allocation (const memory_allocation &) = delete ;
215242 memory_allocation &operator =(const memory_allocation &) = delete ;
0 commit comments