1
1
%module(directors=" 1" ) " cpp11_shared_ptr_director"
2
2
3
3
%{
4
- #include < memory >
4
+ #include < boost/shared_ptr.hpp >
5
5
%}
6
6
7
- %include " std_shared_ptr .i" ;
7
+ %include " boost_shared_ptr .i" ;
8
8
%shared_ptr(C);
9
9
%feature(" director" ) Base;
10
10
@@ -18,18 +18,18 @@ struct C {
18
18
19
19
struct Base {
20
20
Base () {};
21
- virtual std ::shared_ptr<C> ret_c_shared_ptr () = 0;
21
+ virtual boost ::shared_ptr<C> ret_c_shared_ptr () = 0;
22
22
virtual C ret_c_by_value () = 0;
23
23
virtual int take_c_by_value (C c) = 0;
24
- virtual int take_c_shared_ptr_by_value (std ::shared_ptr<C> c) = 0;
25
- virtual int take_c_shared_ptr_by_ref (std ::shared_ptr<C>& c) = 0;
26
- virtual int take_c_shared_ptr_by_pointer (std ::shared_ptr<C>* c) = 0;
27
- virtual int take_c_shared_ptr_by_pointer_ref (std ::shared_ptr<C>*const &c) = 0;
24
+ virtual int take_c_shared_ptr_by_value (boost ::shared_ptr<C> c) = 0;
25
+ virtual int take_c_shared_ptr_by_ref (boost ::shared_ptr<C>& c) = 0;
26
+ virtual int take_c_shared_ptr_by_pointer (boost ::shared_ptr<C>* c) = 0;
27
+ virtual int take_c_shared_ptr_by_pointer_ref (boost ::shared_ptr<C>*const &c) = 0;
28
28
virtual ~Base () {}
29
29
};
30
30
31
31
int call_ret_c_shared_ptr (Base* b) {
32
- std ::shared_ptr<C> ptr = b->ret_c_shared_ptr ();
32
+ boost ::shared_ptr<C> ptr = b->ret_c_shared_ptr ();
33
33
if (ptr) {
34
34
return ptr->get_m ();
35
35
} else {
@@ -48,42 +48,42 @@ int call_take_c_by_value(Base* b) {
48
48
}
49
49
50
50
int call_take_c_shared_ptr_by_value (Base* b) {
51
- std ::shared_ptr<C> ptr (new C (6 ));
51
+ boost ::shared_ptr<C> ptr (new C (6 ));
52
52
return b->take_c_shared_ptr_by_value (ptr);
53
53
}
54
54
55
55
int call_take_c_shared_ptr_by_value_with_null (Base* b) {
56
- std ::shared_ptr<C> ptr;
56
+ boost ::shared_ptr<C> ptr;
57
57
return b->take_c_shared_ptr_by_value (ptr);
58
58
}
59
59
60
60
int call_take_c_shared_ptr_by_ref (Base* b) {
61
- std ::shared_ptr<C> ptr (new C (7 ));
61
+ boost ::shared_ptr<C> ptr (new C (7 ));
62
62
return b->take_c_shared_ptr_by_ref (ptr);
63
63
}
64
64
65
65
int call_take_c_shared_ptr_by_ref_with_null (Base* b) {
66
- std ::shared_ptr<C> ptr;
66
+ boost ::shared_ptr<C> ptr;
67
67
return b->take_c_shared_ptr_by_ref (ptr);
68
68
}
69
69
70
70
int call_take_c_shared_ptr_by_pointer (Base* b) {
71
- std ::shared_ptr<C> ptr (new C (8 ));
71
+ boost ::shared_ptr<C> ptr (new C (8 ));
72
72
return b->take_c_shared_ptr_by_pointer (&ptr);
73
73
}
74
74
75
75
int call_take_c_shared_ptr_by_pointer_with_null (Base* b) {
76
- std ::shared_ptr<C> ptr;
76
+ boost ::shared_ptr<C> ptr;
77
77
return b->take_c_shared_ptr_by_pointer (&ptr);
78
78
}
79
79
80
80
int call_take_c_shared_ptr_by_pointer_ref (Base* b) {
81
- auto ptr = new std ::shared_ptr<C>(new C (9 ));
81
+ boost::shared_ptr<C> * ptr = new boost ::shared_ptr<C>(new C (9 ));
82
82
return b->take_c_shared_ptr_by_pointer_ref (ptr);
83
83
}
84
84
85
85
int call_take_c_shared_ptr_by_pointer_ref_with_null (Base* b) {
86
- auto ptr = new std ::shared_ptr<C>();
86
+ boost::shared_ptr<C> * ptr = new boost ::shared_ptr<C>();
87
87
return b->take_c_shared_ptr_by_pointer_ref (ptr);
88
88
}
89
89
0 commit comments