OGLplus
(0.59.0)
a C++ wrapper for rendering APIs
eagine
range_types.hpp
Go to the documentation of this file.
1
9
#ifndef EAGINE_RANGE_TYPES_HPP
10
#define EAGINE_RANGE_TYPES_HPP
11
12
#include "
types.hpp
"
13
#include "
valid_if/le_size_ge0.hpp
"
14
#include "
valid_if/lt_size_ge0.hpp
"
15
16
namespace
eagine
{
17
//------------------------------------------------------------------------------
18
template
<
typename
R>
19
struct
range_index_type {
20
using
type =
typename
R::size_type;
21
};
22
//------------------------------------------------------------------------------
23
template
<
typename
R>
24
using
range_index_t =
typename
range_index_type<R>::type;
25
//------------------------------------------------------------------------------
26
template
<
typename
R>
27
using
any_range_position = valid_if_nonnegative<range_index_t<R>>;
28
//------------------------------------------------------------------------------
29
template
<
typename
R>
30
using
valid_range_index = valid_if_lt_size_ge0<R, range_index_t<R>>;
31
//------------------------------------------------------------------------------
32
template
<
typename
R>
33
using
valid_range_position = valid_if_le_size_ge0<R, range_index_t<R>>;
34
//------------------------------------------------------------------------------
35
template
<
typename
R,
typename
T>
36
static
constexpr
auto
range_index(T i) noexcept {
37
return
limit_cast<range_index_t<R>>(i);
38
}
39
//------------------------------------------------------------------------------
40
}
// namespace eagine
41
42
#endif // EAGINE_RANGE_TYPES_HPP
eagine
Common code is placed in this namespace.
Definition:
eagine.hpp:21
types.hpp
lt_size_ge0.hpp
le_size_ge0.hpp
Copyright © 2015-2021
Matúš Chochlík
.
<
chochlik -at -gmail.com
>
Documentation generated on Tue Apr 13 2021 by
Doxygen
(version 1.8.17).