From 190ff781eaee33e7a61aab44fc4133718cc0515b Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 13 Jun 2026 00:36:59 +0200 Subject: add .clang-format --- src/handle.hpp | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'src/handle.hpp') diff --git a/src/handle.hpp b/src/handle.hpp index 4bc0a97..5839594 100644 --- a/src/handle.hpp +++ b/src/handle.hpp @@ -8,51 +8,41 @@ #include #include - #include #include -class Handle -{ +class Handle { public: Handle() = default; - explicit Handle(HANDLE raw) - : impl{raw} - { } + explicit Handle(HANDLE raw) : impl{raw} {} - Handle(Handle&& other) noexcept - { + Handle(Handle&& other) noexcept { swap(other); } - Handle& operator=(Handle other) noexcept - { + Handle& operator=(Handle other) noexcept { swap(other); return *this; } - void swap(Handle& other) noexcept - { + void swap(Handle& other) noexcept { using std::swap; swap(impl, other.impl); } - operator HANDLE() const - { + operator HANDLE() const { return impl.get(); } private: - struct Close - { - void operator()(HANDLE raw) const - { + struct Close { + void operator()(HANDLE raw) const { if (raw == NULL || raw == INVALID_HANDLE_VALUE) return; const auto ret = CloseHandle(raw); assert(ret); - (void) ret; + (void)ret; } }; @@ -61,16 +51,15 @@ private: Handle(const Handle&) = delete; }; -inline void swap(Handle& a, Handle& b) noexcept -{ +inline void swap(Handle& a, Handle& b) noexcept { a.swap(b); } -namespace std -{ - template <> - inline void swap(Handle& a, Handle& b) noexcept - { - a.swap(b); - } +namespace std { + +template <> +inline void swap(Handle& a, Handle& b) noexcept { + a.swap(b); } + +} // namespace std -- cgit v1.3