-
Notifications
You must be signed in to change notification settings - Fork 0
/
movable.hpp
99 lines (79 loc) · 3.82 KB
/
movable.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#pragma once
namespace util
{
namespace type_safety
{
struct movable
{
constexpr movable() = delete;
constexpr movable(const movable&) = delete;
consteval movable(movable&&) = default;
consteval auto operator=(movable&&) -> movable& = default;
constexpr auto operator=(const movable&) -> movable& = delete;
constexpr auto operator==(const movable&) const -> bool = delete;
};
struct not_movable
{
consteval not_movable() = default;
consteval not_movable(const not_movable&) = default;
constexpr not_movable(not_movable&&) = delete;
constexpr auto operator=(not_movable&&) -> not_movable& = delete;
constexpr auto operator=(const not_movable&) -> not_movable& = default;
constexpr auto operator==(const not_movable&) const -> bool = default;
};
struct copyable
{
constexpr copyable() = delete;
consteval copyable(const copyable&) = default;
consteval copyable(copyable&&) = default;
consteval auto operator=(copyable&&) -> copyable& = default;
consteval auto operator=(const copyable&) -> copyable& = default;
constexpr auto operator==(const copyable&) const -> bool = delete;
};
struct not_copyable
{
constexpr not_copyable() = default;
consteval not_copyable(const not_copyable&) = delete;
consteval not_copyable(not_copyable&&) = delete;
consteval auto operator=(not_copyable&&) -> not_copyable& = delete;
consteval auto operator=(const not_copyable&) -> not_copyable& = delete;
constexpr auto operator==(const not_copyable&) const -> bool = default;
};
struct not_semiregular
{
constexpr not_semiregular() = delete;
constexpr not_semiregular(const not_semiregular&) = delete;
constexpr not_semiregular(not_semiregular&&) = delete;
constexpr auto operator=(not_semiregular&&) -> not_semiregular& = delete;
constexpr auto operator=(const not_semiregular&) -> not_semiregular& = delete;
constexpr auto operator==(const not_semiregular&) const -> bool = default;
};
struct semiregular
{
constexpr semiregular() = default;
constexpr semiregular(const semiregular&) = default;
constexpr semiregular(semiregular&&) = default;
constexpr auto operator=(semiregular&&) -> semiregular& = default;
constexpr auto operator=(const semiregular&) -> semiregular& = default;
constexpr auto operator==(const semiregular&) const -> bool = delete;
};
struct not_regular
{
constexpr not_regular() = delete;
constexpr not_regular(const not_regular&) = delete;
constexpr not_regular(not_regular&&) = delete;
constexpr auto operator=(not_regular&&) -> not_regular& = delete;
constexpr auto operator=(const not_regular&) -> not_regular& = delete;
constexpr auto operator==(const not_regular&) const -> bool = delete;
};
struct regular
{
constexpr regular() = default;
constexpr regular(const regular&) = default;
constexpr regular(regular&&) = default;
constexpr auto operator=(regular&&) -> regular& = default;
constexpr auto operator=(const regular&) -> regular& = default;
constexpr auto operator==(const regular&) const -> bool = default;
};
} // namespace type_safety
} // namespace util