PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/go/refcount_runme.go

#
Go | 32 lines | 15 code | 7 blank | 10 comment | 4 complexity | d206a059d1e47fe819af21fe0349ff76 MD5 | raw file
 1package main
 2
 3import . "./refcount"
 4
 5// very innocent example
 6
 7func main() {
 8	a := NewA3()
 9	_ = NewB(a)
10	b2 := BCreate(a)
11
12	if a.Ref_count() != 3 {
13		panic("This program will crash... now")
14	}
15
16	rca := b2.Get_rca()
17	// _ = BCreate(rca)
18	_ = rca
19
20	if a.Ref_count() != 4 {
21		panic("This program will crash... now")
22	}
23
24	/* Requires smart pointer support.
25	v := NewVector_A(2)
26	v.Set(0, a)
27	v.Set(1, a)
28
29	_ = v.Get(0)
30	DeleteVector_A(v)
31	*/
32}