From fbd6445c68745d484d5df8c75b0c12054185958f Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 16 Sep 2016 01:47:56 +0300 Subject: move source files to src/ --- handle.hpp | 64 -------------------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 handle.hpp (limited to 'handle.hpp') diff --git a/handle.hpp b/handle.hpp deleted file mode 100644 index 5f83f24..0000000 --- a/handle.hpp +++ /dev/null @@ -1,64 +0,0 @@ -#pragma once - -#include - -#include - -#include -#include - -class Handle -{ -public: - Handle() = default; - - explicit Handle(HANDLE raw) - : impl{raw} - { } - - Handle(Handle&& other) noexcept - { - swap(other); - } - - Handle& operator=(Handle other) noexcept - { - swap(other); - return *this; - } - - void swap(Handle& other) noexcept - { - using std::swap; - swap(impl, other.impl); - } - - operator HANDLE() const - { - return impl.get(); - } - -private: - struct Close - { - void operator()(HANDLE raw) const - { - if (raw == NULL || raw == INVALID_HANDLE_VALUE) - return; - const auto ret = CloseHandle(raw); - assert(ret); - } - }; - - std::unique_ptr impl; - - Handle(const Handle&) = delete; -}; - -namespace std -{ - void swap(Handle& a, Handle& b) noexcept - { - a.swap(b); - } -} -- cgit v1.2.3