Om
moveable.cpp
Go to the documentation of this file.
1 
15 #ifndef Om_Moveable_
16 
17  #include "om/moveable.hpp"
18 
19 #else
20 
21  #ifndef Om_Macro_Precompilation_
22 
23  #include <cassert>
24  #include <stdexcept>
25 
26  #endif
27 
28 // MARK: - Om::Moveable
29 
30  #define Type_ \
31  Om::Moveable
32 
33 // MARK: public (non-static)
34 
35 inline Type_::~Moveable() {}
36 
37 inline std::auto_ptr<Type_> Type_::Move() {
38  assert(0);
39  throw std::logic_error("Pure virtual function called.");
40 }
41 
42  #undef Type_
43 
44 // MARK: - Om::
45 
46 template <typename TheMoveable>
47 inline std::auto_ptr<TheMoveable> Om::Move(TheMoveable & theMoveable) {
48  return std::auto_ptr<TheMoveable>(
49  static_cast<TheMoveable *>(
50  theMoveable.Move().release()
51  )
52  );
53 }
54 
55 #endif
Om header file.
std::auto_ptr< TheMoveable > Move(TheMoveable &)