blob: 65dc8f4315547bc5f43226dfe675d0428f7c0f60 (
plain)
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
|
// CODYlib -*- mode:c++ -*-
// Copyright (C) 2020 Nathan Sidwell, nathan@acm.org
// License: Apache v2.0
// Cody
#include "internal.hh"
namespace Cody {
void Packet::Destroy ()
{
switch (cat)
{
case STRING:
// Silly scope destructor name rules
using S = std::string;
string.~S ();
break;
case VECTOR:
using V = std::vector<std::string>;
vector.~V ();
break;
default:;
}
}
void Packet::Create (Packet &&t)
{
cat = t.cat;
code = t.code;
request = t.request;
switch (cat)
{
case STRING:
new (&string) std::string (std::move (t.string));
break;
case VECTOR:
new (&vector) std::vector<std::string> (std::move (t.vector));
break;
default:
integer = t.integer;
break;
}
}
}
|