Skip to content
LeviMC
Home
Projects
Docs
6
LeviLamina
Mod loader for Minecraft Bedrock Edition
LegacyScriptEngine
Runs LLSE script plugins on LeviLamina
lip
General package installer
LeviLauncher
Bedrock launcher for Windows and Android
Be.D.D.
Scripted client input for mod tests
bedboo
Bedrock bots with a mineflayer-compatible API
All repositories on GitHub
Mods
Blog
Community
About
English
English
简体中文
繁體中文
Auto
Light
Dark
Auto
Light
Dark
LeviLamina
User Guides
Developer Guides
API Guides
API Reference
Maintainer Guides
Resources
LeviLamina on GitHub
LeviMC
Home
Projects
Docs
6
LeviLamina
Mod loader for Minecraft Bedrock Edition
LegacyScriptEngine
Runs LLSE script plugins on LeviLamina
lip
General package installer
LeviLauncher
Bedrock launcher for Windows and Android
Be.D.D.
Scripted client input for mod tests
bedboo
Bedrock bots with a mineflayer-compatible API
All repositories on GitHub
Mods
Blog
Community
About
API Reference
On this page
LeviLamina
User Guides
Developer Guides
API Guides
API Reference
Maintainer Guides
Search
Ctrl
K
Loading...
Searching...
No Matches
EnumSet.h
1
#pragma once
2
3
#include "mc/_HeaderOutputPredefine.h"
4
#include "mc/platform/brstd/bitset.h"
5
6
namespace
Bedrock {
7
8
template
<
typename
TEnum, auto SizeEnum>
9
class
EnumSet
{
10
public
:
11
using
size_type = size_t;
12
static
constexpr
size_type MaxSize =
static_cast<
size_type
>
(SizeEnum);
13
using
mContainertype =
brstd::bitset<MaxSize, std::underlying_type_t<TEnum>
>;
14
using
value_type = TEnum;
15
16
mContainertype mContainer;
17
18
class
iterator {
19
using
reference = TEnum;
20
21
public
:
22
friend
class
EnumSet;
23
iterator(EnumSet
const
& set, size_type index) : set_(&set), index_(index) {}
24
EnumSet
const
* set_;
25
size_type index_;
26
};
27
28
using
const_iterator =
iterator
;
29
30
constexpr
std::pair<iterator, bool> insert(value_type value) {
31
using
U = std::underlying_type_t<TEnum>;
32
auto
idx =
static_cast<
U
>
(value);
33
if
(mContainer.test(idx)) {
34
return
{
iterator
(*
this
, idx),
false
};
35
}
36
mContainer.set(idx);
37
return
{iterator(*
this
, idx),
true
};
38
}
39
40
constexpr
bool
contains(value_type
const
value)
const
{
41
using
U = std::underlying_type_t<TEnum>;
42
return
mContainer.test(
static_cast<
U
>
(value));
43
}
44
};
45
46
}
// namespace Bedrock
Bedrock::EnumSet::iterator
Definition
EnumSet.h:18
Bedrock::EnumSet
Definition
EnumSet.h:9
brstd::bitset
Definition
bitset.h:19
src
mc
deps
core
container
EnumSet.h
Generated on
for LeviLamina by
1.16.1