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

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

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

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

        模板是什么意思?在 C++ 中使用空尖括號?

        What is the meaning of templatelt;gt; with empty angle brackets in C++?(模板是什么意思?在 C++ 中使用空尖括號?)

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

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

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

                  本文介紹了模板是什么意思?在 C++ 中使用空尖括號?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..
                  template<>
                  class A{
                  //some class data
                  };
                  

                  這種代碼我見過很多次了.上面代碼中template<>的作用是什么?在哪些情況下我們需要強制使用它?

                  I have seen this kind of code many times. what is the use of template<> in the above code? And what are the cases where we need mandate the use of it?

                  推薦答案

                  template<> 告訴編譯器遵循模板特化,特別是完全特化.通常,class A 應該是這樣的:

                  template<> tells the compiler that a template specialization follows, specifically a full specialization. Normally, class A would have to look something like this:

                  template<class T>
                  class A{
                    // general implementation
                  };
                  
                  template<>
                  class A<int>{
                    // special implementation for ints
                  };
                  

                  現在,每當使用 A 時,都會使用專用版本.你也可以用它來專門化函數:

                  Now, whenever A<int> is used, the specialized version is used. You can also use it to specialize functions:

                  template<class T>
                  void foo(T t){
                    // general
                  }
                  
                  template<>
                  void foo<int>(int i){
                    // for ints
                  }
                  
                  // doesn't actually need the <int>
                  // as the specialization can be deduced from the parameter type
                  template<>
                  void foo(int i){
                    // also valid
                  }
                  

                  通常情況下,你不應該專門化函數,因為簡單的重載通常被認為是優越的:

                  Normally though, you shouldn't specialize functions, as simple overloads are generally considered superior:

                  void foo(int i){
                    // better
                  }
                  

                  <小時>

                  現在,為了讓它顯得矯枉過正,以下是一個部分專業化:

                  template<class T1, class T2>
                  class B{
                  };
                  
                  template<class T1>
                  class B<T1, int>{
                  };
                  

                  與完全特化的工作方式相同,只是當第二個模板參數是 int(例如,BB 等).

                  Works the same way as a full specialization, just that the specialized version is used whenever the second template parameter is an int (e.g., B<bool,int>, B<YourType,int>, etc).

                  這篇關于模板是什么意思?在 C++ 中使用空尖括號?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 不能)
                  • <small id='xgNiv'></small><noframes id='xgNiv'>

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

                      <tbody id='xgNiv'></tbody>

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

                          <tfoot id='xgNiv'></tfoot>

                            <bdo id='xgNiv'></bdo><ul id='xgNiv'></ul>
                            主站蜘蛛池模板: 人成在线视频 | 伊人伊人网 | 久久久久亚洲精品 | 精品久久久999 | 91高清视频在线 | 亚欧午夜| 高清av在线 | 黄 色 毛片免费 | 欧美一级片在线看 | 日韩中文字幕一区二区 | 一级黄色片免费 | 国产一区在线免费 | www.蜜桃av| 国产一区二区精品在线 | 国产精品精品久久久久久 | 成人妇女免费播放久久久 | 国产精品视频不卡 | av天天干 | 欧美一二三| 色婷婷综合久久久中文字幕 | 亚洲高清在线观看 | 一级高清免费毛片 | 日本不卡在线视频 | 欧美一区二区在线视频 | 成人av高清在线观看 | 国产日韩精品一区 | 91观看| 中文字幕精 | 视频一区在线观看 | 欧美激情国产日韩精品一区18 | 久久亚洲精品久久国产一区二区 | 久久精品一区二区三区四区 | 国产成人综合在线 | 91久久精品一区二区二区 | 91在线免费视频 | 日韩欧美在线一区 | 国产美女精品 | 黄色av一区 | 亚洲风情在线观看 | 91精品国产91久久久久久最新 | 精品亚洲一区二区三区 |