acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
_map_binary_stream.h
1
// From file/binary_stream.h by camilo on 2022-10-14 23:58 <3ThomasBorregaardSorensen!!
2
#pragma once
3
4
5
template
<
typename
PAIR >
6
inline
binary_stream
& operator <<(
binary_stream
&
stream
,
const
pair_map_base < PAIR > & m)
7
{
8
9
10
::collection::count c = m.get_count();
11
12
stream
<< c;
13
14
for
(
auto
&
item
: m)
15
{
16
17
stream
<<
item
.element1();
18
19
//if (s.fail())
20
// break;
21
22
stream
<<
item
.element2();
23
24
//if (s.fail())
25
// break;
26
27
}
28
29
return
stream
;
30
31
}
32
33
34
template
<
typename
PAIR >
35
inline
binary_stream
& operator >>(
binary_stream
&
stream
, pair_map_base < PAIR > & m)
36
{
37
38
::collection::count c = 0;
39
40
stream
>> c;
41
42
auto
i = c;
43
44
while
(i > 0)
45
{
46
47
i--;
48
49
typename
pair_map_base < PAIR >::KEY key;
50
51
stream
>> key;
52
53
if
(
stream
.nok())
54
{
55
56
break
;
57
58
}
59
60
auto
&
payload
= m[key];
61
62
stream
>>
payload
;
63
64
if
(
stream
.nok())
65
{
66
67
m.erase(key);
68
69
break
;
70
71
}
72
73
//m.set_at(element1, element2);
74
75
}
76
77
return
stream
;
78
79
}
80
81
82
binary_stream
Definition
binary_stream.h:12
item
Definition
item.h:93
payload
Definition
payload.h:54
stream
Definition
___serialization_draft.h:42
prototype
collection
_map_binary_stream.h
Generated by
1.17.0