winapi_common
utils.hpp
1 // Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
2 // This file is part of the "winapi-common" project.
3 // For details, see https://github.com/egor-tensin/winapi-common.
4 // Distributed under the MIT License.
5 
6 #pragma once
7 
8 #include <windows.h>
9 
10 #include <cassert>
11 
12 #define WINAPI_UNUSED_PARAMETER(...) (void)(__VA_ARGS__)
13 
14 namespace winapi {
15 
16 struct LocalDelete {
17  void operator()(void* ptr) const {
18  const auto ret = ::LocalFree(ptr);
19  assert(ret == NULL);
20  WINAPI_UNUSED_PARAMETER(ret);
21  }
22 };
23 
24 } // namespace winapi