OGLplus
(0.59.0)
a C++ wrapper for rendering APIs
eagine
memory
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
>
20
using
basic_offset_span
=
memory::basic_span<T, basic_offset_ptr<T, O>
, S>;
21
//------------------------------------------------------------------------------
24
template
<
typename
T>
25
using
offset_span
=
basic_offset_span<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>,
36
memory::basic_span<T, basic_offset_ptr<T, O>
, O>> {
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
45
->
basic_span<T, basic_offset_ptr<T, std::make_signed_t<S>
>, S> {
46
return
{spn};
47
}
48
//------------------------------------------------------------------------------
49
}
// namespace eagine::memory
50
51
#endif // EAGINE_MEMORY_OFFSET_SPAN_HPP
eagine::memory::basic_offset_ptr
Basic offset pointer class template.
Definition:
offset_ptr.hpp:24
eagine::memory::basic_span
Non-owning view of a contiguous range of memory with ValueType elements.
Definition:
flatten_fwd.hpp:16
offset_ptr.hpp
eagine::memory::relative
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
span.hpp
Copyright © 2015-2021
Matúš Chochlík
.
<
chochlik -at -gmail.com
>
Documentation generated on Tue Apr 13 2021 by
Doxygen
(version 1.8.17).