MemoryWriter Helper class
A general physical layout guideline: Put all public members, functions as well as variables, first, followed by protected members, and private members at the end. You want users to see public members first, followed by protected members. Hopefully, they don't have to see private members at all.

I added white spaces around functions to make them more readable.

class MemoryWriter {

   public:

      MemoryWriter(DWORD address) {
         _currentIndex = 0;
         _targetAddress = (LPVOID)address;
      }

      template&lt;typename T&gt;
         void write(T data)
         {
            editMemory&lt;T&gt;(((DWORD)_targetAddress + _currentIndex), data);
            _currentIndex += sizeof(T);
         }

      template&lt;typename T&gt;
         void write(LPVOID address, T data)
         {
            editMemory&lt;T&gt;((DWORD)address, data);
            _currentIndex = (DWORD)address;
         }

      void reset(LPVOID newAddress = NULL)
      {
         _currentIndex = 0;

         if (newAddress)
            _targetAddress = newAddress;
      }

   protected:

   private:

      USHORT _currentIndex;
      LPVOID _targetAddress;

      template&lt;typename T&gt;
         static void editMemory(DWORD address, T data)
         {
            DWORD oldProtection;
            VirtualProtect((LPVOID)address, sizeof(T), PAGE_EXECUTE_READWRITE, &amp;oldProtection);
            *((T*)address) = data;
            VirtualProtect((LPVOID)address, sizeof(T), PAGE_EXECUTE_READWRITE, NULL);
         }
};