C++ Memory Mapped File Implementation

前端 未结 2 729
面向向阳花
面向向阳花 2021-01-21 11:52

I have no problems implementing the memory mapped file. The question is. Assuming this returns a valid memory view.

void* pBuf = MapViewOfFile(hMapFile,  
               


        
2条回答
  •  不要未来只要你来
    2021-01-21 12:17

    You can use the placement new operator or you can cast the address to a structure or class you want to use. The advantage of placement new is that the constructor of the class will be called. If you use from then on that pointer you don't need to copy the data but read and write directly to it.

提交回复
热议问题