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

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

  • <tfoot id='jx56Z'></tfoot>

        <bdo id='jx56Z'></bdo><ul id='jx56Z'></ul>
      1. <legend id='jx56Z'><style id='jx56Z'><dir id='jx56Z'><q id='jx56Z'></q></dir></style></legend>

      2. <small id='jx56Z'></small><noframes id='jx56Z'>

        在 C++ 中打印出變量名的通用方法

        generic way to print out variable name in c++(在 C++ 中打印出變量名的通用方法)
            <legend id='Up7cc'><style id='Up7cc'><dir id='Up7cc'><q id='Up7cc'></q></dir></style></legend>
              <i id='Up7cc'><tr id='Up7cc'><dt id='Up7cc'><q id='Up7cc'><span id='Up7cc'><b id='Up7cc'><form id='Up7cc'><ins id='Up7cc'></ins><ul id='Up7cc'></ul><sub id='Up7cc'></sub></form><legend id='Up7cc'></legend><bdo id='Up7cc'><pre id='Up7cc'><center id='Up7cc'></center></pre></bdo></b><th id='Up7cc'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Up7cc'><tfoot id='Up7cc'></tfoot><dl id='Up7cc'><fieldset id='Up7cc'></fieldset></dl></div>

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

                <bdo id='Up7cc'></bdo><ul id='Up7cc'></ul>

                  <tfoot id='Up7cc'></tfoot>
                    <tbody id='Up7cc'></tbody>
                • 本文介紹了在 C++ 中打印出變量名的通用方法的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  給定一個類

                  struct {
                    int a1;
                    bool a2;
                    ...
                    char* a500;
                    ...
                    char a10000;      
                  }
                  

                  我想打印或流式輸出

                  "a1 value is SOME_VALUE"  
                  "a2 value is SOME_VALUE"
                  "a500 value is SOME_VALUE"
                  ...
                  "a10000 value is SOME_VALUE"
                  

                  成員變量的類型不一樣(主要是int、bool、char*等,即不需要重載<<運算符),成員變量名可以任意命名,即,沒有規(guī)律可循.有沒有一種通用的方法,而不是一個一個地明確輸入(非常繁瑣且容易出錯的工作)?

                  the type of the member variables are not the same (mainly, int, bool, char*, etc, i.e., no need to overload << operator), and the member variable name could be named with anything, i.e., no rule to follow. Instead of typing explicitely one by one (very big tedious, and error-prone work), is there any generic way?

                  感謝您的評論!

                  推薦答案

                  您正在尋找的功能通常稱為 反射.它不是 C++ 的一部分,因為在編譯語言中,您所追求的信息(人類可讀的變量名)通常不會被編譯器保留.不需要運行代碼,所以包含它沒有意義.

                  The feature you're looking for is typically called reflection. It is not part of C++, since in compiled languages the information you're after (human-readable variable names) is generally not kept by the compiler. It is not needed to run the code, so there's no point in including it.

                  調試器通常可以檢查帶外符號信息,或為此目的保存在二進制文件中的符號數據,以顯示此類名稱,但為此目的重新執(zhí)行此操作可能比它的價值更多.

                  Debuggers can often inspect either out-of-band symbol information, or symbol data kept in binaries for this very purpose, to show such names but re-doing that for this purpose is probably more work than it's worth.

                  我建議您尋找許多技巧"(=解決方案)中的一些來自己實施.

                  I would suggest looking for some of the many "tricks" (=solutions) to implement this yourself.

                  這篇關于在 C++ 中打印出變量名的通用方法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Why do two functions have the same address?(為什么兩個函數的地址相同?)
                  Why the initializer of std::function has to be CopyConstructible?(為什么 std::function 的初始化程序必須是可復制構造的?)
                  mixing templates with polymorphism(混合模板與多態(tài)性)
                  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 不能)

                    <tfoot id='cY0Go'></tfoot>
                        <tbody id='cY0Go'></tbody>

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

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

                            主站蜘蛛池模板: 激情小说综合网 | 欧美aⅴ | 人人干在线视频 | 亚洲欧美激情国产综合久久久 | 久在线 | 激情 一区| 国产亚洲一区二区在线观看 | 久优草| 国产精品视频播放 | 国产综合精品一区二区三区 | 亚洲精品视频免费观看 | 91久久精品一区二区二区 | 久久久精彩视频 | 免费观看一级特黄欧美大片 | 成人亚洲| 欧美午夜一区 | 久久精品一区二区视频 | 国产精品视屏 | 成人免费毛片在线观看 | 欧美性大战xxxxx久久久 | 欧美激情国产精品 | 一区在线观看 | 视频一区二区三区中文字幕 | 精品国产一区探花在线观看 | 久久乐国产精品 | 91视频久久| 91精品国产综合久久久久久丝袜 | 国产一区二区三区在线 | 高清视频一区二区三区 | 久久久成人精品 | 日韩欧美成人精品 | 国产精品国产成人国产三级 | 午夜黄色影院 | 最新国产精品 | 久草视频2 | 一区二区高清不卡 | 国产精品美女久久久久aⅴ国产馆 | 精品一区二区三区在线观看国产 | 国产午夜久久久 | 美女久久| 一区二区三区视频免费看 |