-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_v3.cc
50 lines (37 loc) · 862 Bytes
/
test_v3.cc
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
#include <iostream>
#include "soa_v3.h"
#define check(X) \
do { std::cout << #X " is " << (X) << std::endl; } while(false)
DECLARE_SOA_TEMPLATE(SoA,
(double, x),
(double, y),
(double, z),
(uint16_t, colour),
(int32_t, value),
(const char *, name)
);
int main(void) {
std::cout << std::boolalpha;
check(sizeof(SoA<1>));
std::cout << std::endl;
dump<SoA<1>>();
dump<SoA<10>>();
dump<SoA<31>>();
dump<SoA<32>>();
std::cout << std::endl;
dump<SoA<1, 64>>();
dump<SoA<10, 64>>();
dump<SoA<31, 64>>();
dump<SoA<32, 64>>();
std::cout << std::endl;
SoA<10, 32> soa;
check(& soa.z()[7] == & (soa[7].z()));
soa[7].x() = 0.;
soa[7].y() = 3.1416;
soa[7].z() = -1.;
soa[7].colour() = 42;
soa[7].value() = 9999;
soa[7].name() = "element";
soa[9] = soa[7];
return not (& soa.z()[7] == & (soa[7].z()));
}