久久久久久久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. 本文介紹了讀取輸入文件,最快的方法?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(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ū)⑽彝扑]給一個有完整解釋的網(wǎ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)制文件是最快的選擇.您不僅可以在單個操作中使用原始 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) 讀取字符串的第一個字符?)
                  What is the cin analougus of scanf formatted input?(scanf 格式輸入的 cin 類比是什么?)
                  Issue with cin when spaces are inputted, using string class(使用字符串類輸入空格時出現(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>
                            主站蜘蛛池模板: 二区中文| 精品久久久久久久久久久久 | 成人免费视屏 | 欧美成人免费在线 | 男女免费在线观看视频 | 伊人久久综合影院 | 国产日屁| 国产欧美日韩一区 | 久久久久久国模大尺度人体 | 天天玩夜夜操 | 毛片区| 国产激情视频网 | 免费一区二区三区在线视频 | 欧美视频二区 | 男人天堂色| 韩日一区 | 欧美国产精品 | 午夜精品视频一区 | 欧美日韩视频 | 久久国产精品视频 | 在线国产小视频 | 亚洲最新网址 | 国产精品自拍av | 久久99精品久久久久久秒播九色 | 国产精品视频导航 | 伊人久操| 久久国产精品视频 | 91亚洲精品国偷拍自产在线观看 | 天堂精品 | 国产精品国产成人国产三级 | 亚洲成av人片在线观看无码 | 久热电影| 日韩精品一区二区三区在线播放 | 国产成人精品免费视频大全最热 | 精品国产99 | 国产精品欧美一区喷水 | 91激情视频 | 狠狠操狠狠操 | 亚洲精品欧美 | 欧美日韩在线视频观看 | 久久精片|