diff --git a/toolbox/stackframe.h b/toolbox/stackframe.h index 48c46fc..9b72394 100644 --- a/toolbox/stackframe.h +++ b/toolbox/stackframe.h @@ -2,6 +2,7 @@ #define __StackFrame_h__ #include +#include // @@ -22,9 +23,9 @@ void ToolReturn(uint32_t sp, uint32_t value) // pre-define these templates to prevent instantiation errors. template -uint32_t StackFrame__(uint32_t sp, uint32_t &x, Args&... args); +uint32_t StackFrame__(uint32_t sp, uint32_t &x, Args&&... args); template -uint32_t StackFrame__(uint32_t sp, uint16_t &x, Args&... args); +uint32_t StackFrame__(uint32_t sp, uint16_t &x, Args&&... args); template uint32_t StackFrame__(uint32_t sp); @@ -39,27 +40,27 @@ uint32_t StackFrame__(uint32_t sp) } template -uint32_t StackFrame__(uint32_t sp, uint32_t &x, Args&... args) +uint32_t StackFrame__(uint32_t sp, uint32_t &x, Args&&... args) { x = memoryReadLong(sp + Offset - 4); - return StackFrame__(sp, args...); + return StackFrame__(sp, std::forward(args)...); } template -uint32_t StackFrame__(uint32_t sp, uint16_t &x, Args&... args) +uint32_t StackFrame__(uint32_t sp, uint16_t &x, Args&&... args) { x = memoryReadWord(sp + Offset - 2); - return StackFrame__(sp, args...); + return StackFrame__(sp, std::forward(args)...); } template -uint32_t StackFrame(Args&... args) +uint32_t StackFrame(Args&&... args) { uint32_t sp = cpuGetAReg(7); - return StackFrame__(sp, args...); + return StackFrame__(sp, std::forward(args)...); }