-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtuple03.cpp
More file actions
39 lines (27 loc) · 731 Bytes
/
tuple03.cpp
File metadata and controls
39 lines (27 loc) · 731 Bytes
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
#include <vector>
#include <cassert>
#include "src/tuple03.h"
int main()
{
std::vector<int> v;
v.push_back(42);
tpl< int, tpl < std::vector<int> > > t(42, v);
/*value_at<0>(t) = 42;
value_at<1>(t) = v;*/
t.set(42).set(v);
assert(value_at<0>(t) == 42);
assert(value_at<1>(t).size() == 1);
ptn< int, ptn < std::vector<int> > > t2;
assert(value_at<0>(t2) == NULL);
assert(value_at<1>(t2) == NULL);
value_at<1>(t2) = &v;
assert(value_at<1>(t2)->size() == 1);
tpl< int, tpl< int > > two_ints;
two_ints.fill(42, 1);
assert(value_at<0>(two_ints) == 42);
assert(value_at<1>(two_ints) == 1);
two_ints.set(skip()).set(0);
assert(value_at<0>(two_ints) == 42);
assert(value_at<1>(two_ints) == 0);
return 0;
}