<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          C++核心準則?SL.io.50:避免使用endl

          SL.io.50: Avoid?endl

          SL.io.50:避免使用endl


          Reason(原因)

          The?endl?manipulator is mostly equivalent to?'\n'?and?"\n"; as most commonly used it simply slows down output by doing redundant?flush()s. This slowdown can be significant compared to?printf-style output.

          endl操縱符差不多等于是'\ n'和“ \ n”;使用它最常見的結(jié)果是通過執(zhí)行多余的flush()來減慢輸出速度。與printf樣式的輸出相比,這種速度下降可能會顯著。


          Example(示例)

          cout << "Hello, World!" << endl;    // two output operations and a flush
          cout << "Hello, World!\n"; // one output operation and no flush
          Note(注意)

          For?cin/cout?(and equivalent) interaction, there is no reason to flush; that's done automatically. For writing to a file, there is rarely a need to?flush.

          對于cin / cout(和等效的)交互,沒有理由刷新;那是自動完成的。對于文件寫入,幾乎不需要刷新。


          Note(注意)

          Apart from the (occasionally important) issue of performance, the choice between?'\n'?and?endl?is almost completely aesthetic.

          除了(有時很重要的)性能問題之外,在'\ n'和endl之間進行選擇幾乎是完全取決于美感的。


          原文鏈接

          https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#slio50-avoid-endl


          新書介紹

          《實戰(zhàn)Python設計模式》是作者最近出版的新書,拜托多多關注!

          本書利用Python 的標準GUI 工具包tkinter,通過可執(zhí)行的示例對23 個設計模式逐個進行說明。這樣一方面可以使讀者了解真實的軟件開發(fā)工作中每個設計模式的運用場景和想要解決的問題;另一方面通過對這些問題的解決過程進行說明,讓讀者明白在編寫代碼時如何判斷使用設計模式的利弊,并合理運用設計模式。

          對設計模式感興趣而且希望隨學隨用的讀者通過本書可以快速跨越從理解到運用的門檻;希望學習Python GUI 編程的讀者可以將本書中的示例作為設計和開發(fā)的參考;使用Python 語言進行圖像分析、數(shù)據(jù)處理工作的讀者可以直接以本書中的示例為基礎,迅速構建自己的系統(tǒng)架構。




          覺得本文有幫助?請分享給更多人。

          關注微信公眾號【面向?qū)ο笏伎肌枯p松學習每一天!

          面向?qū)ο箝_發(fā),面向?qū)ο笏伎迹?/span>



          瀏覽 64
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  免费黄色小说网站 | 手机亚洲午夜成人网 | 欧美性爱操逼网 | 五月天啪啪网 | 欧美xxxx操 |