From 0c62070b24273e565cce112ab061df6665d3ae8c Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 27 Oct 2020 13:17:26 +0300 Subject: code style Don't use brace initialization in constructors, VS 2013 doesn't like that. --- test/unit_tests/shared/worker.hpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'test/unit_tests/shared/worker.hpp') 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 +#include + #include #include @@ -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 -- cgit v1.2.3