IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
collections
public
ice
types
nindex.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/types/ncount.hxx
>
6
7
namespace
ice
8
{
9
10
struct
nindex_invalid_t
;
11
12
struct
nindex
:
public
ice::nvalue
13
{
14
using
nvalue::base_type
;
15
using
nvalue::base_signed_type
;
16
using
ice::nvalue::operator==;
17
18
// support for allocation sizes
19
constexpr
auto
offset
(
this
nindex
self)
noexcept
->
ice::isize
;
20
21
constexpr
nindex
() noexcept = default;
22
constexpr
nindex
(
nvalue
value) noexcept;
23
constexpr
nindex
(
base_type
value) noexcept;
24
constexpr
nindex
(
base_type
value,
base_type
width) noexcept;
25
26
// special operators
27
constexpr
bool
operator==(this
ncount
self,
nindex_invalid_t
) noexcept;
28
};
29
30
struct
nindex_invalid_t
:
nindex
{};
31
32
inline
constexpr
auto
nindex::offset
(
this
nindex
self)
noexcept
->
ice::isize
33
{
34
return
{ self._value *
static_cast<
ice::isize::base_type
>
(self._width) };
35
}
36
37
inline
constexpr
nindex::nindex
(
nvalue
value) noexcept
38
:
nvalue
{ value._width, value._value }
39
{ }
40
41
inline
constexpr
nindex::nindex
(
base_type
value) noexcept
42
:
nvalue
{ 1,
static_cast<
base_signed_type
>
(value) }
43
{ }
44
45
inline
constexpr
nindex::nindex
(
base_type
value,
base_type
width) noexcept
46
:
nvalue
{ width,
static_cast<
base_signed_type
>
(value) }
47
{ }
48
49
inline
constexpr
bool
nindex::operator==
(
this
ncount
self,
nindex_invalid_t
)
noexcept
50
{
51
return
self._width == 0;
52
}
53
54
static
constexpr
ice::nindex
nindex_max
{
ice::detail::nvalue_max_value
() };
55
static
constexpr
ice::nindex
nindex_min
{
ice::detail::nvalue_min_value
() };
56
static
constexpr
ice::nindex_invalid_t
nindex_none
{ };
57
58
constexpr
auto
operator
""
_index(
unsigned
long
long
value)
noexcept
->
ice::nindex
59
{
60
return
ice::nindex
{ value };
61
}
62
63
}
// namespace ice
ice::detail::nvalue_min_value
consteval auto nvalue_min_value() noexcept -> ice::detail::nvalue_base_utype
Definition
nvalue.hxx:63
ice::detail::nvalue_max_value
consteval auto nvalue_max_value() noexcept -> ice::detail::nvalue_base_utype
Definition
nvalue.hxx:68
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::nindex_min
static constexpr ice::nindex nindex_min
Definition
nindex.hxx:55
ice::nindex_none
static constexpr ice::nindex_invalid_t nindex_none
Definition
nindex.hxx:56
ice::nindex_max
static constexpr ice::nindex nindex_max
Definition
nindex.hxx:54
ncount.hxx
ice::isize
Represents a signed size value on the given platform.
Definition
mem_size_types.hxx:14
ice::isize::base_type
std::conditional_t< ice::build::is_x64, ice::i64, ice::i32 > base_type
Definition
mem_size_types.hxx:16
ice::ncount
Definition
ncount.hxx:14
ice::nindex_invalid_t
Definition
nindex.hxx:30
ice::nindex
Definition
nindex.hxx:13
ice::nindex::base_signed_type
ice::detail::nvalue_base_stype base_signed_type
Definition
nvalue.hxx:76
ice::nindex::operator==
constexpr bool operator==(this ncount self, nindex_invalid_t) noexcept
Definition
nindex.hxx:49
ice::nindex::offset
constexpr auto offset(this nindex self) noexcept -> ice::isize
Definition
nindex.hxx:32
ice::nindex::nindex
constexpr nindex() noexcept=default
ice::nindex::base_type
ice::detail::nvalue_base_utype base_type
Definition
nvalue.hxx:75
ice::nvalue
Definition
nvalue.hxx:74
ice::nvalue::base_signed_type
ice::detail::nvalue_base_stype base_signed_type
Definition
nvalue.hxx:76
ice::nvalue::base_type
ice::detail::nvalue_base_utype base_type
Definition
nvalue.hxx:75
Generated by
1.18.0