Fastest way to write large STL vector to file using STL

后端 未结 7 718
一个人的身影
一个人的身影 2021-02-06 06:53

I have a large vector (10^9 elements) of chars, and I was wondering what is the fastest way to write such vector to a file. So far I\'ve been using next code:

ve         


        
相关标签:
7条回答
  • 2021-02-06 07:19

    Instead of writing via the file i/o methods, you could try to create a memory-mapped file, and then copy the vector to the memory-mapped file using memcpy.

    0 讨论(0)
提交回复
热议问题