chsvlib
chsv helper source code
AutoHandle< close_func_t, close_func, invalid_handle_t_n > Struct Template Reference

A class defining functionality for automated management of Windows resources, described by the HANDLE values, e.g. files, processes, tokens, etc. More...

#include <chsvwinutilex.h>

Inheritance diagram for AutoHandle< close_func_t, close_func, invalid_handle_t_n >:
Collaboration diagram for AutoHandle< close_func_t, close_func, invalid_handle_t_n >:

Public Member Functions

 operator bool () const
 Returns whether a handle is currently managed by the AutoHandle object.
 
 AutoHandle (HANDLE h=HANDLE()) noexcept
 Constructs an AutoHandle object with an optional handle to be managed. More...
 

Detailed Description

template<class close_func_t, close_func_t close_func, class... invalid_handle_t_n>
struct Chusov::Win32::Memory::AutoHandle< close_func_t, close_func, invalid_handle_t_n >

A class defining functionality for automated management of Windows resources, described by the HANDLE values, e.g. files, processes, tokens, etc.

Template Parameters
close_func_tis a type of a pointer to a function, closing the acquired resources. A common value is decltype(&CloseHandle).
close_funcis a pointer to a closing function itself, such as CloseHandle. The function is not required to validate handle values, as it is performed by the class.
invalid_handle_t_nis a pack of types defining a value static data member of the HANDLE type. A managed handle equal to the value of any pack type is considered non-closable, i.e. if a managed handle equals to one of the values defined by the pack, the closing function is not called for the handle.
See also
check_handle_t;
invalid_handle_value_t;
null_handle_value_t.

The documentation for this struct was generated from the following file: