Skip to content

Commit 674534e

Browse files
committed
Make VT hooks ability to move
1 parent 03d368a commit 674534e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

include/dynlibutils/vthook.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ class CVTHook : public CMemory
143143
public:
144144
using Function_t = R (*)(Args...); // Is the pointer‐to‐function type matching the signature of the virtual method.
145145

146+
CVTHook() = default;
147+
CVTHook(const CVTHook &other) = delete;
148+
CVTHook(CVTHook &&other) : CMemory(std::exchange(static_cast<CMemory &>(other), DYNLIB_INVALID_MEMORY)), m_pOriginalFn(std::exchange(static_cast<CMemory &>(other.m_pOriginalFn), DYNLIB_INVALID_MEMORY)) {}
146149
~CVTHook()
147150
{
148151
if (IsHooked())
@@ -238,6 +241,7 @@ class CVTFHook : public CVTHook<R, Args...>
238241
{
239242
public:
240243
using CBase = CVTHook<R, Args...>;
244+
using CBase::CBase;
241245
using Function_t = std::function<R (Args...)>; // Allowing lambdas or other callable objects that match R(Args...) to be used as the hook target.
242246

243247
void Clear() { CBase::Clear(); sm_callback = nullptr; }
@@ -281,6 +285,10 @@ template<class T>
281285
class CVTMHookBase
282286
{
283287
public:
288+
CVTMHookBase() = default;
289+
CVTMHookBase(const CVTMHookBase &other) = delete;
290+
CVTMHookBase(CVTMHookBase &&other) = default;
291+
284292
using Element_t = T;
285293
using Function_t = typename Element_t::Function_t;
286294

0 commit comments

Comments
 (0)