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