Om
default_copyable.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_DefaultCopyable_
16 
17  #include "om/default_copyable.hpp"
18 
19 #else
20 
21 // MARK: - Om::DefaultCopyable
22 
23  #define Template_ \
24  template < \
25  typename ThisImplementation, \
26  typename ThisInterface \
27  >
28 
29  #define Type_ \
30  Om::DefaultCopyable< \
31  ThisImplementation, \
32  ThisInterface \
33  >
34 
35 // MARK: public (non-static)
36 
37 Template_
38 inline Type_::~DefaultCopyable() {}
39 
40 Template_
41 inline std::auto_ptr<Om::Copyable> Type_::Copy() const {
42  assert(
43  dynamic_cast<ThisImplementation const *>(this)
44  );
45  return std::auto_ptr<Copyable>(
46  new ThisImplementation(
47  static_cast<ThisImplementation const &>(*this)
48  )
49  );
50 }
51 
52  #undef Type_
53  #undef Template_
54 
55 #endif
Om header file.
std::auto_ptr< TheCopyable > Copy(TheCopyable const &)