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

/trunk/Examples/test-suite/smart_pointer_multi.i

#
Swig | 39 lines | 32 code | 7 blank | 0 comment | 0 complexity | aeff62f7d593e551a3518b152e18eeba MD5 | raw file
 1// Test cases for classes that do *NOT* result in smart-pointer wrapping
 2%module smart_pointer_multi
 3
 4%inline %{
 5struct Foo {
 6   int x;
 7   int getx() { return x; }
 8};
 9
10class Bar {
11   Foo *f;
12public:
13   Bar(Foo *f) : f(f) { }
14   Foo *operator->() {
15      return f;
16   }
17};
18
19class Spam {
20   Bar *b;
21public:
22   Spam(Bar *b) : b(b) { }
23   Bar operator->() {
24      return *b;
25   }
26};
27
28class Grok {
29   Bar *b;
30public:
31   Grok(Bar *b) : b(b) { }
32   Bar &operator->() {
33      return *b;
34   }
35};
36   
37%}
38
39