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

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

        <legend id='XlNPI'><style id='XlNPI'><dir id='XlNPI'><q id='XlNPI'></q></dir></style></legend>

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

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

        強類型定義

        Strong typedefs(強類型定義)
          <bdo id='XZxV6'></bdo><ul id='XZxV6'></ul>
        • <tfoot id='XZxV6'></tfoot>
            <i id='XZxV6'><tr id='XZxV6'><dt id='XZxV6'><q id='XZxV6'><span id='XZxV6'><b id='XZxV6'><form id='XZxV6'><ins id='XZxV6'></ins><ul id='XZxV6'></ul><sub id='XZxV6'></sub></form><legend id='XZxV6'></legend><bdo id='XZxV6'><pre id='XZxV6'><center id='XZxV6'></center></pre></bdo></b><th id='XZxV6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XZxV6'><tfoot id='XZxV6'></tfoot><dl id='XZxV6'><fieldset id='XZxV6'></fieldset></dl></div>

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

                  <tbody id='XZxV6'></tbody>
                <legend id='XZxV6'><style id='XZxV6'><dir id='XZxV6'><q id='XZxV6'></q></dir></style></legend>

                  本文介紹了強類型定義的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  有沒有辦法制作一個類型的完整副本,以便在模板推導(dǎo)上下文中區(qū)分它們?舉個例子:

                  #include 模板 結(jié)構(gòu)測試{靜態(tài) int c(){靜態(tài)整數(shù) t = 0;返回 t++;}};typedef int 句柄;int main(){std::cout <<測試<int>::c()<<std::endl;std::cout <<測試<句柄>::c()<

                  由于 typedef 只為一個類型創(chuàng)建一個別名,這將打印 0, 1而不是所需的 0, 0.是否有任何解決方法?

                  解決方案

                  引用 cplusplus.com,

                  <塊引用>

                  請注意,既不是 typedef 也不是 using 創(chuàng)建新的不同數(shù)據(jù)類型.它們只創(chuàng)建現(xiàn)有類型的同義詞.這意味著類型上面的 myword 用 WORD 類型聲明,也可以考慮輸入無符號整數(shù);這并不重要,因為兩者實際上都是指的是同一類型.

                  由于inthandle 相同,輸出0 1 是預(yù)期的.>

                  不過,正如@interjay 建議的那樣,有一個解決方法.

                  您可以使用BOOST_STRONG_TYPEDEF.

                  BOOST_STRONG_TYPEDEF( int , handle );

                  Is there any way to make a complete copy of a type so that they can be distinguished in template deduction context? Take the example:

                  #include <iostream>
                  
                  template <typename T>
                  struct test
                  {
                      static int c()
                      { 
                          static int t = 0;
                          return t++;
                      }
                  };
                  
                  typedef int handle;
                  
                  int main()
                  {
                      std::cout << test<int>::c() << std::endl;
                      std::cout << test<handle>::c() << std::endl;
                      return 0;
                  }
                  

                  Since typedef only makes an alias for a type, this prints 0, 1 instead of the desired 0, 0. Is there any workaround for this?

                  解決方案

                  Quoting cplusplus.com,

                  Note that neither typedef nor using create new distinct data types. They only create synonyms of existing types. That means that the type of myword above, declared with type WORD, can as well be considered of type unsigned int; it does not really matter, since both are actually referring to the same type.

                  Since int and handle are one and the same, the output 0 1 is expected.

                  There's a workaround though, as @interjay suggests.

                  You can use BOOST_STRONG_TYPEDEF.

                  BOOST_STRONG_TYPEDEF( int , handle );
                  

                  這篇關(guān)于強類型定義的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

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

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

                    <tbody id='bXxBm'></tbody>

                  <legend id='bXxBm'><style id='bXxBm'><dir id='bXxBm'><q id='bXxBm'></q></dir></style></legend>
                    • <bdo id='bXxBm'></bdo><ul id='bXxBm'></ul>

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

                          • 主站蜘蛛池模板: 亚洲永久免费 | 男人天堂99 | 欧美日韩一二三区 | 国产福利观看 | 中文字幕二区 | 国产精品视频在线播放 | 国产高清视频一区 | 在线国产一区二区 | 久久久免费观看视频 | 日韩网 | 国产区第一页 | 一区二区三区欧美 | 91成人| 国产成人亚洲精品自产在线 | 久久精品亚洲成在人线av网址 | 中文字幕 国产 | 国产欧美精品 | 超碰在线播 | 欧美精品久久久久 | 亚洲看片 | 欧美二区三区 | 免费一区| 日韩1区 | 欧美日韩亚洲在线 | 天天天操操操 | 亚洲精品一区二区另类图片 | 91国产视频在线 | 亚洲国产成人av好男人在线观看 | 777zyz色资源站在线观看 | av网站推荐 | 久久噜噜噜精品国产亚洲综合 | 欧美日韩不卡 | 午夜精品一区二区三区在线播放 | 久草成人网 | 99热这里都是精品 | 亚洲国产aⅴ成人精品无吗 国产精品永久在线观看 | 精品国产一区二区国模嫣然 | 高清一区二区三区 | 神马久久春色视频 | 亚洲高清在线观看 | 精品国产欧美一区二区 |