Polymorphic wrapper for executors.
| 45 | |
| 46 | /// Polymorphic wrapper for executors. |
| 47 | class executor |
| 48 | { |
| 49 | public: |
| 50 | /// Default constructor. |
| 51 | executor() ASIO_NOEXCEPT |
| 52 | : impl_(0) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | /// Construct from nullptr. |
| 57 | executor(nullptr_t) ASIO_NOEXCEPT |
| 58 | : impl_(0) |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | /// Copy constructor. |
| 63 | executor(const executor& other) ASIO_NOEXCEPT |
| 64 | : impl_(other.clone()) |
| 65 | { |
| 66 | } |
| 67 | |
| 68 | #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) |
| 69 | /// Move constructor. |
| 70 | executor(executor&& other) ASIO_NOEXCEPT |
| 71 | : impl_(other.impl_) |
| 72 | { |
| 73 | other.impl_ = 0; |
| 74 | } |
| 75 | #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) |
| 76 | |
| 77 | /// Construct a polymorphic wrapper for the specified executor. |
| 78 | template <typename Executor> |
| 79 | executor(Executor e); |
| 80 | |
| 81 | /// Allocator-aware constructor to create a polymorphic wrapper for the |
| 82 | /// specified executor. |
| 83 | template <typename Executor, typename Allocator> |
| 84 | executor(allocator_arg_t, const Allocator& a, Executor e); |
| 85 | |
| 86 | /// Destructor. |
| 87 | ~executor() |
| 88 | { |
| 89 | destroy(); |
| 90 | } |
| 91 | |
| 92 | /// Assignment operator. |
| 93 | executor& operator=(const executor& other) ASIO_NOEXCEPT |
| 94 | { |
| 95 | destroy(); |
| 96 | impl_ = other.clone(); |
| 97 | return *this; |
| 98 | } |
| 99 | |
| 100 | #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) |
| 101 | // Move assignment operator. |
| 102 | executor& operator=(executor&& other) ASIO_NOEXCEPT |
| 103 | { |
| 104 | destroy(); |