cgv
Loading...
Searching...
No Matches
bool32_t.h
1
#pragma once
2
3
#include <cstdint>
4
#include <utility>
5
6
namespace
cgv
{
7
namespace
type {
8
14
class
bool32_t
{
15
public
:
16
bool32_t
() =
default
;
17
bool32_t
(
const
bool32_t
&) =
default
;
18
bool32_t
& operator=(
const
bool32_t
&) =
default
;
19
bool32_t
(
bool32_t
&&)
noexcept
=
default
;
20
bool32_t
& operator=(
bool32_t
&&)
noexcept
=
default
;
21
22
// construct from primitive bool type
23
bool32_t
(
const
bool
& other) : v_(other) {};
24
25
// assign from primitive bool type
26
bool32_t
& operator=(
const
bool
& other) {
27
v_ = other;
28
return
*
this
;
29
};
30
31
// move construct from primitive bool type
32
bool32_t
(
bool
&& other) noexcept : v_(std::move(other)) {};
33
34
// move assign from primitive bool type
35
bool32_t
& operator=(
bool
&& other)
noexcept
{
36
v_ = std::move(other);
37
return
*
this
;
38
};
39
40
// convert to primitive bool type
41
operator
bool()
const
{
42
return
static_cast<
bool
>
(v_);
43
}
44
45
private
:
46
// store the value as an int32_t to occupy 4 bytes of memory
47
int32_t v_;
48
};
49
50
}
// namespace type
51
}
// namespace cgv
cgv::type::bool32_t
Class type that emulates the primitive bool data type by storing its value as a 32-bit integer.
Definition
bool32_t.h:14
cgv
this header is dependency free
Definition
print.h:11
cgv
type
bool32_t.h
Generated by
1.9.8