OGLplus
(0.59.0)
a C++ wrapper for rendering APIs
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
Functions
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
u
Variables
Typedefs
a
b
c
d
e
g
h
i
k
l
m
n
o
p
r
s
t
u
v
Enumerations
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
d
e
f
g
h
i
k
m
n
o
p
r
s
t
u
v
Related Functions
o
Files
File List
File Members
All
Macros
Examples
eagine
enum_range.hpp
Go to the documentation of this file.
1
9
#ifndef EAGINE_ENUM_RANGE_HPP
10
#define EAGINE_ENUM_RANGE_HPP
11
12
#include "
assert.hpp
"
13
#include "
enum_class.hpp
"
14
#include "
iterator.hpp
"
15
#include "
memory/span.hpp
"
16
#include <cstdint>
17
#include <utility>
18
19
namespace
eagine
{
20
//------------------------------------------------------------------------------
21
template
<
typename
EnumClass>
22
class
enumerated_value_range;
23
//------------------------------------------------------------------------------
24
template
<
typename
EnumClass,
typename
T,
id
entifier_t LibId,
id
entifier_t EnumId>
25
class
enumerated_value_range<enum_class<EnumClass, T, LibId, EnumId>> {
26
private
:
27
const
T* _begin;
28
const
T* _end;
29
30
using
_ec_t = enum_class<EnumClass, T, LibId, EnumId>;
31
32
static
_ec_t _wrap_enum(T e) noexcept {
33
return
_ec_t{e};
34
}
35
36
public
:
37
using
value_type
= _ec_t;
38
using
size_type =
span_size_t
;
39
40
explicit
enumerated_value_range(memory::span<const T> v) noexcept
41
: _begin(v.data())
42
, _end(v.data() + v.size()) {
43
EAGINE_ASSERT(_begin <= _end);
44
}
45
46
explicit
enumerated_value_range(std::pair<const void*, size_type> p) noexcept
47
: enumerated_value_range(
48
memory::span<const T>{
static_cast<
const
T*
>
(p.first), p.second}) {}
49
50
using
iterator =
51
transforming_iterator<
const
T*, _ec_t, _ec_t, _ec_t (*)(T) noexcept>;
52
53
size_type size() const noexcept {
54
return
size_type(_end - _begin);
55
}
56
57
iterator begin() const noexcept {
58
return
iterator(_begin, &_wrap_enum);
59
}
60
61
iterator end() const noexcept {
62
return
iterator(_end, &_wrap_enum);
63
}
64
};
65
//------------------------------------------------------------------------------
66
}
// namespace eagine
67
68
#endif // EAGINE_ENUM_RANGE_HPP
eagine::valtree::value_type
value_type
Value tree value element data type enumeration.
Definition:
interface.hpp:27
eagine::span_size_t
std::ptrdiff_t span_size_t
Signed span size type used by eagine.
Definition:
types.hpp:36
eagine
Common code is placed in this namespace.
Definition:
eagine.hpp:21
iterator.hpp
assert.hpp
enum_class.hpp
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).