diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-10-27 13:17:26 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-10-27 13:18:45 +0300 |
commit | 0c62070b24273e565cce112ab061df6665d3ae8c (patch) | |
tree | a9a36ef593871daef57986fbfbbfb44de8c1116d /test/unit_tests/shared/worker.hpp | |
parent | Boost.Test is broken in 1.62 (diff) | |
download | winapi-common-0c62070b24273e565cce112ab061df6665d3ae8c.tar.gz winapi-common-0c62070b24273e565cce112ab061df6665d3ae8c.zip |
code style
Don't use brace initialization in constructors, VS 2013 doesn't like
that.
Diffstat (limited to 'test/unit_tests/shared/worker.hpp')
-rw-r--r-- | test/unit_tests/shared/worker.hpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/test/unit_tests/shared/worker.hpp b/test/unit_tests/shared/worker.hpp index 320a924..a1067ac 100644 --- a/test/unit_tests/shared/worker.hpp +++ b/test/unit_tests/shared/worker.hpp @@ -9,6 +9,8 @@ #include <winapi/process.hpp> +#include <boost/config.hpp> + #include <windows.h> #include <exception> @@ -20,7 +22,23 @@ namespace worker { class Worker { public: - Worker(winapi::Process&& process) : m_cmd{Command::create()}, m_process{std::move(process)} {} + Worker(winapi::Process&& process) : m_cmd(Command::create()), m_process(std::move(process)) {} + + Worker(Worker&& other) BOOST_NOEXCEPT_OR_NOTHROW : m_cmd(std::move(other.m_cmd)), + m_process(std::move(other.m_process)) {} + + Worker& operator=(Worker other) BOOST_NOEXCEPT_OR_NOTHROW { + swap(other); + return *this; + } + + void swap(Worker& other) BOOST_NOEXCEPT_OR_NOTHROW { + using std::swap; + swap(m_cmd, other.m_cmd); + swap(m_process, other.m_process); + } + + Worker(const Worker&) = delete; ~Worker() { try { @@ -83,4 +101,17 @@ private: winapi::Process m_process; }; +inline void swap(Worker& a, Worker& b) BOOST_NOEXCEPT_OR_NOTHROW { + a.swap(b); +} + } // namespace worker + +namespace std { + +template <> +inline void swap(worker::Worker& a, worker::Worker& b) BOOST_NOEXCEPT_OR_NOTHROW { + a.swap(b); +} + +} // namespace std |