Smart pointer documentation improvement

This commit is contained in:
William S Fulton 2013-09-03 23:58:05 +01:00
commit f47075ec99

View file

@ -4433,7 +4433,7 @@ around some other class. For example:
template<class T> class SmartPtr { template<class T> class SmartPtr {
T *pointee; T *pointee;
public: public:
... SmartPtr(T *p) : pointee(p) { ... }
T *operator->() { T *operator->() {
return pointee; return pointee;
} }
@ -4453,7 +4453,7 @@ typedef SmartPtr<Foo_Impl> Foo;
// Create smart pointer Foo // Create smart pointer Foo
Foo make_Foo() { Foo make_Foo() {
return SmartPtr(new Foo_Impl()); return SmartPtr<Foo_Impl>(new Foo_Impl());
} }
// Do something with smart pointer Foo // Do something with smart pointer Foo
@ -4461,6 +4461,9 @@ void do_something(Foo f) {
printf("x = %d\n", f->x); printf("x = %d\n", f->x);
f->bar(); f->bar();
} }
// Call the wrapped smart pointer proxy class in the target language 'Foo'
%template(Foo) SmartPtr<Foo_Impl>;
</pre> </pre>
</div> </div>