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
|
/*
* The contects of this file is in the Public Domain.
*
* Created by Gustav Hartivgsson.
*/
namespace Vee {
[Compact]
public class Pair<T1, T2> {
public T1 v1;
public T2 v2;
public unowned FreeFunc v1_free_func;
public unowned FreeFunc v2_free_func;
[CCode (cname = "v_pair_new")]
public Pair (T1 v1, T2 v2) {
this.v1 = v1;
this.v2 = v2;
}
public Pair.with_free_func (T1 v1, T2 v2,
FreeFunc v1_free_func,
FreeFunc v2_free_func) {
this.v1 = v1;
this.v2 = v2;
this.v1_free_func = v1_free_func;
this.v2_free_func = v2_free_func;
}
~Pair () {
if (this.v1_free_func != null) {
this.v1_free_func (v1);
}
if (this.v2_free_func != null) {
this.v2_free_func (v2);
}
}
}
}
|