|
PStack
2.0
Stack trace printer for MSVC and GCC binaries
|
Base unique_handle functionality common to all template specializations. More...
#include <unique_handle.hpp>


Friends | |
| template<typename T2 , typename , T2 kInvalidHandle2> | |
| class | unique_handle |
| Limit use of this class ONLY to unique_handle; they are two halves of the same interface. | |
Type Declarations | |
| using | deleter_type = D |
| The data-type of the clean-up facility. | |
| using | handle_type = T |
| The data-type of the handle being managed. | |
Construction / Destruction | |
| unique_handle_impl (handle_type handle) noexcept | |
| Construct this base container object with a handle. More... | |
Copy Construction | |
| unique_handle_impl (unique_handle_impl const &)=delete | |
| Disable copying because it will likely be deleted twice. | |
| unique_handle_impl & | operator= (unique_handle_impl &)=delete |
| Disable copy-assignment to prevent double-frees. | |
Public Interface | |
| handle_type | get () const noexcept |
| Access the handle contained in this object. More... | |
| handle_type | release () noexcept |
| Release the handle from being managed by this class. More... | |
Operator Overloads | |
| operator bool () const noexcept | |
| Determines the validity of this instance. More... | |
Member Data | |
| handle_type | m_handle |
| The handle that will be managed by this class. | |
Additional Inherited Members | |
Static Public Member Functions inherited from psystem::stack_allocated | |
| static void | operator delete (void *)=delete |
| Individual object deletion. | |
| static void | operator delete[] (void *)=delete |
| Array of type object deletion. | |
| static void * | operator new (size_t)=delete |
| Individual object allocation. | |
| static void * | operator new[] (size_t)=delete |
| Array of type allocation. | |
Base unique_handle functionality common to all template specializations.
Construction of this class is private, and only the declared friend, unique_handle can create an instance of this class. This class should be considered part of unique_handle — the part that provides the interface that has nothing to do with the "deleter". Template specializations for unique_handle focus on optimizing the memory size by removing the deleter field from the structure if it is a stateless function invocation (e.g., CloseHandle from the Win32 API).
constexpr is not possible on Windows, which makes the invalid_handle_value member not possible. It would be great to change the instances of kInvalidHandle back to invalid_handle_value when MSVC brings itself up to three years ago.
|
inlineexplicitprivatenoexcept |
Construct this base container object with a handle.
| [in] | handle | The handle value to hold on behalf of derived classes. This may be invalid_handle_value. |
|
inlinenoexcept |
Access the handle contained in this object.
|
inlineexplicitnoexcept |
Determines the validity of this instance.
This is comperable to a nullptr check for pointer types. The conversion is a "contextual" conversion, so it will work implicitly with boolean operators and if statements, but cannot implicitly convert to a boolean container.
true if this instance contains a valid handle, false, otherwise.
|
inlinenoexcept |
Release the handle from being managed by this class.
invalid_handle_value.