Sauce-0.10.1
A C++ Dependency Injection Framework
disposal_deleter.h
1 #ifndef SAUCE_INTERNAL_DISPOSAL_DELETER_H_
2 #define SAUCE_INTERNAL_DISPOSAL_DELETER_H_
3 
4 #include <sauce/memory.h>
5 
6 namespace sauce {
7 namespace internal {
8 
12 template<typename Iface, typename Disposal>
14  typedef sauce::shared_ptr<Disposal> DisposalPtr;
15 
16  DisposalPtr disposal;
17 
18 public:
19 
20  DisposalDeleter(DisposalPtr disposal):
21  disposal(disposal) {}
22 
26  void operator()(Iface * iface) const {
27  disposal->dispose(iface);
28  }
29 };
30 
31 }
32 
33 namespace i = ::sauce::internal;
34 
35 }
36 
37 #endif // SAUCE_INTERNAL_DISPOSAL_DELETER_H_
void operator()(Iface *iface) const
Cast and dispose the given Iface instance.
Definition: disposal_deleter.h:26
A smart pointer deleter that diposes with the given disposal.
Definition: disposal_deleter.h:13
Definition: binder.h:317
Definition: binder.h:21