acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
single.h
1
#pragma once
2
3
4
#define MAKE_SINGLE(SINGLE, T, MEMBER) \
5
class SINGLE \
6
{ \
7
public: \
8
\
9
\
10
using TYPE = T; \
11
using ARG_TYPE = argument_of < TYPE >; \
12
\
13
\
14
T MEMBER; \
15
\
16
\
17
TYPE & element() { return MEMBER; } \
18
const TYPE & element() const { return MEMBER; } \
19
\
20
\
21
SINGLE() {} \
22
SINGLE(ARG_TYPE t) : MEMBER(t) {} \
23
\
24
\
25
}
26
27
28
template
<
typename
T >
29
MAKE_SINGLE(
single
, T, m_element);
30
31
32
template
<
typename
SINGLE >
33
struct
make_single :
34
public
SINGLE
35
{
36
public
:
37
38
39
using
TYPE =
typename
SINGLE::TYPE;
40
using
ARG_TYPE =
typename
SINGLE::ARG_TYPE;
41
42
using
ELEMENT1 = TYPE;
43
using
ARG_ELEMENT1 = ARG_TYPE;
44
using
ELEMENT2 = TYPE;
45
using
ARG_ELEMENT2 = ARG_TYPE;
46
47
48
using
KEY = TYPE;
49
using
ARG_KEY = ARG_TYPE;
50
using
PAYLOAD = TYPE;
51
using
ARG_PAYLOAD = ARG_TYPE;
52
53
54
inline
auto
& topic() {
return
*
this
;}
55
inline
auto
& item() {
return
this->element(); }
56
57
inline
auto
& topic()
const
{
return
*
this
; }
58
inline
auto
& item()
const
{
return
this->element(); }
59
60
inline
auto
& key() {
return
this->element();}
61
inline
auto
& key()
const
{
return
this->element(); }
62
63
inline
auto
& payload() {
return
this->element(); }
64
inline
auto
& payload()
const
{
return
this->element(); }
65
66
67
68
make_single() {}
69
make_single(ARG_TYPE t) : SINGLE(t) {}
70
71
72
void
defer_set_payload(ARG_PAYLOAD)
73
{
74
75
76
}
77
78
79
};
80
81
82
83
single
Definition
_template_forward_declaration.h:304
prototype
collection
single.h
Generated by
1.17.0