久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <small id='CEESn'></small><noframes id='CEESn'>

        <bdo id='CEESn'></bdo><ul id='CEESn'></ul>
    1. <tfoot id='CEESn'></tfoot>
      1. <legend id='CEESn'><style id='CEESn'><dir id='CEESn'><q id='CEESn'></q></dir></style></legend>
        <i id='CEESn'><tr id='CEESn'><dt id='CEESn'><q id='CEESn'><span id='CEESn'><b id='CEESn'><form id='CEESn'><ins id='CEESn'></ins><ul id='CEESn'></ul><sub id='CEESn'></sub></form><legend id='CEESn'></legend><bdo id='CEESn'><pre id='CEESn'><center id='CEESn'></center></pre></bdo></b><th id='CEESn'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CEESn'><tfoot id='CEESn'></tfoot><dl id='CEESn'><fieldset id='CEESn'></fieldset></dl></div>

        讀取輸入文件,最快的方法?

        read input files, fastest way possible?(讀取輸入文件,最快的方法?)

        <small id='2LiIZ'></small><noframes id='2LiIZ'>

        <legend id='2LiIZ'><style id='2LiIZ'><dir id='2LiIZ'><q id='2LiIZ'></q></dir></style></legend>
          <bdo id='2LiIZ'></bdo><ul id='2LiIZ'></ul>
        • <i id='2LiIZ'><tr id='2LiIZ'><dt id='2LiIZ'><q id='2LiIZ'><span id='2LiIZ'><b id='2LiIZ'><form id='2LiIZ'><ins id='2LiIZ'></ins><ul id='2LiIZ'></ul><sub id='2LiIZ'></sub></form><legend id='2LiIZ'></legend><bdo id='2LiIZ'><pre id='2LiIZ'><center id='2LiIZ'></center></pre></bdo></b><th id='2LiIZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='2LiIZ'><tfoot id='2LiIZ'></tfoot><dl id='2LiIZ'><fieldset id='2LiIZ'></fieldset></dl></div>
            <tbody id='2LiIZ'></tbody>
              <tfoot id='2LiIZ'></tfoot>

                1. 本文介紹了讀取輸入文件,最快的方法?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有許多浮點(diǎn)數(shù)形式的數(shù)據(jù)文本文件.我正在尋找用 C++ 讀取它們的最快方法.如果這是最快的,我可以將文件更改為二進(jìn)制文件.

                  I have numerous text files of data in the form of float numbers. I'm looking for the fastest way to read them in C++. I can change the file to binary if that's the fastest.

                  如果您能給我提示或?qū)⑽彝扑]給一個(gè)有完整解釋的網(wǎng)站,那就太好了.我不知道是否有任何庫可以快速完成工作.即使有任何開源軟件可以完成這項(xiàng)工作,也會有所幫助.

                  It would be great if you could give me hint or refer me to a website with complete explanation. I don't know whether there is any library that does the work fast. Even if there is any open source software that does the work, that would be helpful.

                  推薦答案

                  擁有二進(jìn)制文件是最快的選擇.您不僅可以在單個(gè)操作中使用原始 istream::read 直接在數(shù)組中讀取它(非常快),而且如果您的操作系統(tǒng)支持,您甚至可以將文件映射到內(nèi)存中;您可以在 POSIX 系統(tǒng)上使用 open/mmapCreateFile/CreateFileMapping/MapViewOfFile在 Windows 上,甚至是 Boost 跨平臺解決方案(感謝 @Cory Nelson 指出).

                  Having a binary file is the fastest option. Not only you can read it directly in an array with a raw istream::read in a single operation (which is very fast), but you can even map the file in memory if your OS supports it; you can use open/mmap on POSIX systems, CreateFile/CreateFileMapping/MapViewOfFile on Windows, or even the Boost cross-platform solution (thanks @Cory Nelson for pointing it out).

                  快速&臟示例,假設(shè)文件包含一些 float 的原始表示:

                  Quick & dirty examples, assuming the file contains the raw representation of some floats:

                  正常"閱讀:

                  #include <fstream>
                  #include <vector>
                  
                  // ...
                  
                  // Open the stream
                  std::ifstream is("input.dat");
                  // Determine the file length
                  is.seekg(0, std::ios_base::end);
                  std::size_t size=is.tellg();
                  is.seekg(0, std::ios_base::beg);
                  // Create a vector to store the data
                  std::vector<float> v(size/sizeof(float));
                  // Load the data
                  is.read((char*) &v[0], size);
                  // Close the file
                  is.close();
                  

                  使用共享內(nèi)存:

                  #include <boost/interprocess/file_mapping.hpp>
                  #include <boost/interprocess/mapped_region.hpp>
                  
                  using boost::interprocess;
                  
                  // ....
                  
                  // Create the file mapping
                  file_mapping fm("input.dat", read_only);
                  // Map the file in memory
                  mapped_region region(fm, read_only);
                  // Get the address where the file has been mapped
                  float * addr = (float *)region.get_address();
                  std::size_t elements  = region.get_size()/sizeof(float);
                  

                  這篇關(guān)于讀取輸入文件,最快的方法?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  The easiest way to read formatted input in C++?(在 C++ 中讀取格式化輸入的最簡單方法?)
                  Reading from .txt file into two dimensional array in c++(從 .txt 文件讀取到 C++ 中的二維數(shù)組)
                  How to simulate a key press in C++(如何在 C++ 中模擬按鍵按下)
                  Why doesn#39;t getline(cin, var) after cin.ignore() read the first character of the string?(為什么在 cin.ignore() 之后沒有 getline(cin, var) 讀取字符串的第一個(gè)字符?)
                  What is the cin analougus of scanf formatted input?(scanf 格式輸入的 cin 類比是什么?)
                  Issue with cin when spaces are inputted, using string class(使用字符串類輸入空格時(shí)出現(xiàn) cin 問題)
                2. <tfoot id='kFc1k'></tfoot>
                    <tbody id='kFc1k'></tbody>
                3. <small id='kFc1k'></small><noframes id='kFc1k'>

                4. <legend id='kFc1k'><style id='kFc1k'><dir id='kFc1k'><q id='kFc1k'></q></dir></style></legend>

                      • <i id='kFc1k'><tr id='kFc1k'><dt id='kFc1k'><q id='kFc1k'><span id='kFc1k'><b id='kFc1k'><form id='kFc1k'><ins id='kFc1k'></ins><ul id='kFc1k'></ul><sub id='kFc1k'></sub></form><legend id='kFc1k'></legend><bdo id='kFc1k'><pre id='kFc1k'><center id='kFc1k'></center></pre></bdo></b><th id='kFc1k'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kFc1k'><tfoot id='kFc1k'></tfoot><dl id='kFc1k'><fieldset id='kFc1k'></fieldset></dl></div>

                        • <bdo id='kFc1k'></bdo><ul id='kFc1k'></ul>
                            主站蜘蛛池模板: 永久免费看mv网站入口亚洲 | 久久久久久一区 | 欧美亚洲在线观看 | 欧美专区第一页 | 欧美福利一区 | 97人人插| av免费网站 | 国产精品偷拍 | 欧美一级做性受免费大片免费 | 深夜福利免费 | 亚洲成av | 欧美精品一区二区在线观看 | 成年网站在线观看 | 日韩有码在线观看 | 国产精品成人一区二区三区 | 精品视频免费在线观看 | 国产一级在线 | 91视频观看 | 91av免费在线观看 | 国产com| 日韩精品成人 | 免费一级黄色录像 | 亚洲特级片 | 亚洲在线视频观看 | 国产精品自在线 | 欧美视频一区二区 | 在线看日韩 | 日本免费一级片 | 国产欧美一区二区精品性色超碰 | 国产精品美女久久久久久久久 | 中文字幕精品在线观看 | 欧美激情视频一区 | 91伊人网| 一区二区三区在线观看免费 | 亚洲视频中文字幕 | 五月在线视频 | 天天澡天天狠天天天做 | 三级福利视频 | 国产黄色片网站 | 欧美网站在线观看 | 可以在线观看的av |