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

    1. <small id='w5OK9'></small><noframes id='w5OK9'>

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

        “永久"標準::設置

        quot;Permanentquot; std::setw(“永久標準::設置)
            <i id='VLLwR'><tr id='VLLwR'><dt id='VLLwR'><q id='VLLwR'><span id='VLLwR'><b id='VLLwR'><form id='VLLwR'><ins id='VLLwR'></ins><ul id='VLLwR'></ul><sub id='VLLwR'></sub></form><legend id='VLLwR'></legend><bdo id='VLLwR'><pre id='VLLwR'><center id='VLLwR'></center></pre></bdo></b><th id='VLLwR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VLLwR'><tfoot id='VLLwR'></tfoot><dl id='VLLwR'><fieldset id='VLLwR'></fieldset></dl></div>

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

              <tbody id='VLLwR'></tbody>
                <bdo id='VLLwR'></bdo><ul id='VLLwR'></ul>
                <legend id='VLLwR'><style id='VLLwR'><dir id='VLLwR'><q id='VLLwR'></q></dir></style></legend>

                1. <tfoot id='VLLwR'></tfoot>

                  本文介紹了“永久"標準::設置的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  有沒有辦法永久設置 std::setw 操縱器(或其功能 width)?看看這個:

                  Is there any way how to set std::setw manipulator (or its function width) permanently? Look at this:

                  #include <iostream>
                  #include <iomanip>
                  #include <algorithm>
                  #include <iterator>
                  
                  int main( void )
                  {
                    int array[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256 };
                    std::cout.fill( '0' );
                    std::cout.flags( std::ios::hex );
                    std::cout.width( 3 );
                  
                    std::copy( &array[0], &array[9], std::ostream_iterator<int>( std::cout, " " ) );
                  
                    std::cout << std::endl;
                  
                    for( int i = 0; i < 9; i++ )
                    {
                      std::cout.width( 3 );
                      std::cout << array[i] << " ";
                    }
                    std::cout << std::endl;
                  }
                  

                  運行后,我看到:

                  001 2 4 8 10 20 40 80 100
                  
                  001 002 004 008 010 020 040 080 100
                  

                  即除了必須為每個條目設置的 setw/width 之外,每個操縱符都保持自己的位置.有沒有什么優雅的方法可以將 std::copy(或其他東西)與 setw 一起使用?我所說的優雅當然不是指創建自己的函子或函數來將內容寫入 std::cout.

                  I.e. every manipulator holds its place except the setw/width which must be set for every entry. Is there any elegant way how to use std::copy (or something else) along with setw? And by elegant I certainly don't mean creating own functor or function for writing stuff into std::cout.

                  推薦答案

                  好吧,這是不可能的.沒有辦法讓它每次都調用 .width .但是你當然可以使用 boost:

                  Well, it's not possible. No way to make it call .width each time again. But you can use boost, of course:

                  #include <boost/function_output_iterator.hpp>
                  #include <boost/lambda/lambda.hpp>
                  #include <algorithm>
                  #include <iostream>
                  #include <iomanip>
                  
                  int main() {
                      using namespace boost::lambda;
                      int a[] = { 1, 2, 3, 4 };
                      std::copy(a, a + 4, 
                          boost::make_function_output_iterator( 
                                var(std::cout) << std::setw(3) << _1)
                          );
                  }
                  

                  確實創建了自己的函子,但它發生在幕后:)

                  It does create its own functor, but it happens behind the scene :)

                  這篇關于“永久"標準::設置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Why do two functions have the same address?(為什么兩個函數的地址相同?)
                  Why the initializer of std::function has to be CopyConstructible?(為什么 std::function 的初始化程序必須是可復制構造的?)
                  mixing templates with polymorphism(混合模板與多態性)
                  When should I use the keyword quot;typenamequot; when using templates(我什么時候應該使用關鍵字“typename?使用模板時)
                  Dependent name resolution amp; namespace std / Standard Library(依賴名稱解析命名空間 std/標準庫)
                  gcc can compile a variadic template while clang cannot(gcc 可以編譯可變參數模板,而 clang 不能)
                2. <small id='AJ9GI'></small><noframes id='AJ9GI'>

                          <tbody id='AJ9GI'></tbody>

                        <i id='AJ9GI'><tr id='AJ9GI'><dt id='AJ9GI'><q id='AJ9GI'><span id='AJ9GI'><b id='AJ9GI'><form id='AJ9GI'><ins id='AJ9GI'></ins><ul id='AJ9GI'></ul><sub id='AJ9GI'></sub></form><legend id='AJ9GI'></legend><bdo id='AJ9GI'><pre id='AJ9GI'><center id='AJ9GI'></center></pre></bdo></b><th id='AJ9GI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='AJ9GI'><tfoot id='AJ9GI'></tfoot><dl id='AJ9GI'><fieldset id='AJ9GI'></fieldset></dl></div>
                        <tfoot id='AJ9GI'></tfoot>
                          <bdo id='AJ9GI'></bdo><ul id='AJ9GI'></ul>
                          <legend id='AJ9GI'><style id='AJ9GI'><dir id='AJ9GI'><q id='AJ9GI'></q></dir></style></legend>
                          1. 主站蜘蛛池模板: 综合精品久久久 | 男人天堂网av | 日本一区二区不卡 | 成人欧美一区二区三区色青冈 | 国产福利在线 | 日一区二区三区 | 在线国产一区二区 | 亚洲一区国产精品 | 黄色av大片 | 精品欧美在线观看 | av资源在线看 | 久热久草 | 久久久久国产精品一区三寸 | 99久久久国产精品 | 日韩精品福利 | 一区二区影视 | 毛片黄片| 91久久久久久久久久久 | 91亚洲精品在线观看 | 天天操天天操 | 欧美一级黄色网 | 91色在线视频 | 国产精品成人一区二区三区 | 欧美综合国产精品久久丁香 | 亚洲av毛片 | 九九热九九 | 国产aaaaav久久久一区二区 | 欧美一级做性受免费大片免费 | 日韩欧美国产一区二区 | 在线观看亚洲精品视频 | 欧美一区二区三区在线 | 视频第一区 | 久久最新| 九九综合 | 欧美白人做受xxxx视频 | 久久一区二区三区电影 | 欧洲一区二区视频 | 久久精品综合 | 色综合久久久 | 亚洲成人精品国产 | 国产激情视频 |