OGLplus  (0.59.0) a C++ wrapper for rendering APIs

offset_span.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_MEMORY_OFFSET_SPAN_HPP
10 #define EAGINE_MEMORY_OFFSET_SPAN_HPP
11 
12 #include "offset_ptr.hpp"
13 #include "span.hpp"
14 
15 namespace eagine::memory {
16 //------------------------------------------------------------------------------
19 template <typename T, typename O = span_size_t, typename S = span_size_t>
21 //------------------------------------------------------------------------------
24 template <typename T>
26 //------------------------------------------------------------------------------
27 template <typename T, typename O>
28 auto view_one(basic_offset_ptr<T, O> ptr) -> memory::
29  basic_span<std::add_const_t<T>, basic_offset_ptr<std::add_const_t<T>, O>, O> {
30  return {ptr, O(1)};
31 }
32 //------------------------------------------------------------------------------
33 template <typename T, typename O>
34 auto cover_one(basic_offset_ptr<T, O> ptr) -> std::enable_if_t<
35  !std::is_const_v<T>,
37  return {ptr, O(1)};
38 }
39 //------------------------------------------------------------------------------
43 template <typename T, typename P, typename S>
44 static constexpr auto relative(basic_span<T, P, S> spn) noexcept
46  return {spn};
47 }
48 //------------------------------------------------------------------------------
49 } // namespace eagine::memory
50 
51 #endif // EAGINE_MEMORY_OFFSET_SPAN_HPP
Basic offset pointer class template.
Definition: offset_ptr.hpp:24
Non-owning view of a contiguous range of memory with ValueType elements.
Definition: flatten_fwd.hpp:16
static constexpr auto relative(basic_span< T, P, S > spn) noexcept -> basic_span< T, basic_offset_ptr< T, std::make_signed_t< S >>, S >
Converts argument to span using an offset pointer type.
Definition: offset_span.hpp:44

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).