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

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

      3. <legend id='uL64K'><style id='uL64K'><dir id='uL64K'><q id='uL64K'></q></dir></style></legend>
      4. 刪除“通用"的專用模板函數(shù)案例無法使用

        Specialized template function with deleted quot;generalquot; case fails to compile with g++ lt;=4.8.0 and clang++(刪除“通用的專用模板函數(shù)案例無法使用 g++ lt;=4.8.0 和 clang++ 編譯) - IT屋-程序員軟件開發(fā)技術(shù)分享

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

        1. <legend id='D4Yhe'><style id='D4Yhe'><dir id='D4Yhe'><q id='D4Yhe'></q></dir></style></legend>

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

                • <i id='D4Yhe'><tr id='D4Yhe'><dt id='D4Yhe'><q id='D4Yhe'><span id='D4Yhe'><b id='D4Yhe'><form id='D4Yhe'><ins id='D4Yhe'></ins><ul id='D4Yhe'></ul><sub id='D4Yhe'></sub></form><legend id='D4Yhe'></legend><bdo id='D4Yhe'><pre id='D4Yhe'><center id='D4Yhe'></center></pre></bdo></b><th id='D4Yhe'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='D4Yhe'><tfoot id='D4Yhe'></tfoot><dl id='D4Yhe'><fieldset id='D4Yhe'></fieldset></dl></div>
                    <tbody id='D4Yhe'></tbody>
                • <tfoot id='D4Yhe'></tfoot>
                  本文介紹了刪除“通用"的專用模板函數(shù)案例無法使用 g++ &lt;=4.8.0 和 clang++ 編譯的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  用舊版本的g++(4.8.0,MinGW)編譯項(xiàng)目我發(fā)現(xiàn)這段代碼編譯失敗:

                  Compiling a project with an older version of g++ (4.8.0, MinGW) I found that this code fails to compile:

                  template<typename T>
                  void foo() = delete;
                  
                  template<>
                  void foo<int>(){}
                  
                  int main() {
                      foo<int>();
                      return 0;
                  }
                  

                  如果 g++ 看到基本情況被刪除,它似乎甚至不會(huì)嘗試尋找顯式特化.

                  It seems that g++ doesn't even try to look for explicit specializations if it sees that the base case is deleted.

                  mitalia@mitalia:~/scratch$ /opt/mingw32-dw2/bin/i686-w64-mingw32-g++ -std=c++11 buggy_deleted_template.cpp 
                  buggy_deleted_template.cpp: In function 'int main()':
                  buggy_deleted_template.cpp:8:14: error: use of deleted function 'void foo() [with T = int]'
                       foo<int>();
                                ^
                  buggy_deleted_template.cpp:5:6: error: declared here
                   void foo<int>(){}
                        ^
                  mitalia@mitalia:~/scratch$ /opt/mingw32-dw2/bin/i686-w64-mingw32-g++ --version 
                  i686-w64-mingw32-g++ (rubenvb-4.8.0) 4.8.0
                  Copyright (C) 2013 Free Software Foundation, Inc.
                  This is free software; see the source for copying conditions.  There is NO
                  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
                  

                  相反,g++ 4.8.4 和 5.2(在 Linux 上)不會(huì)抱怨.這是老版本編譯器的BUG還是標(biāo)準(zhǔn)的灰色地帶?

                  Instead, g++ 4.8.4 and 5.2 (on Linux) do not complain. Is this a bug in the older version of the compiler or a gray area in the standard?

                  附錄

                  clang 3.4.1 似乎也不喜歡它:

                  clang 3.4.1 too seems not to like it:

                  mitalia@mitalia:~/scratch$ clang++ -std=c++11 buggy_deleted_template.cpp                                                             
                  buggy_deleted_template.cpp:5:6: error: redefinition of 'foo'                                                                         
                  void foo<int>(){}
                       ^
                  buggy_deleted_template.cpp:5:6: note: previous definition is here
                  buggy_deleted_template.cpp:8:5: error: no matching function for call to 'foo'
                      foo<int>();
                      ^~~~~~~~
                  buggy_deleted_template.cpp:2:6: note: candidate template ignored: substitution failure [with T = int]
                  void foo() = delete;
                       ^
                  2 errors generated.
                  mitalia@mitalia:~/scratch$ clang++ --version
                  Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
                  Target: x86_64-pc-linux-gnu
                  Thread model: posix
                  

                  (和 @Baum mit Augen 在評(píng)論中報(bào)告說它在 3.7 中仍然不起作用)

                  (and @Baum mit Augen in the comments reports that it still doesn't work in 3.7)

                  推薦答案

                  我不知道以下內(nèi)容是否有啟發(fā),但我發(fā)現(xiàn)了 缺陷報(bào)告 941:已刪除函數(shù)模板的顯式特化 ,狀態(tài)為 C++11,聲明如下<強(qiáng)>(強(qiáng)調(diào)我的):

                  I don't know if the following will be enlightening but I found defect report 941: Explicit specialization of deleted function template with status C++11 that states the following (Emphasis Mine):

                  根據(jù) 14.7.3 [temp.expl.spec] 第 1 段,僅未刪除函數(shù)模板可以被明確地專門化.沒有然而,似乎是對(duì)這一限制的迫切需要,而且它可能有助于禁止使用隱式實(shí)例化專業(yè)化,同時(shí)仍然允許使用顯式專業(yè)化版本.

                  According to 14.7.3 [temp.expl.spec] paragraph 1, only non-deleted function templates may be explicitly specialized. There doesn't appear to be a compelling need for this restriction, however, and it could be useful to forbid use of implicitly-instantiated specializations while still allowing use of explicitly-specialized versions.

                  提議的決議(2010 年 2 月):

                  Proposed resolution (February, 2010):

                  將 14.7.3 [temp.expl.spec] 第 1 段更改如下:

                  Change 14.7.3 [temp.expl.spec] paragraph 1 as follows:

                  以下任何一項(xiàng)的明確特化:

                  An explicit specialization of any of the following:

                  未刪除函數(shù)模板

                  類模板

                  未刪除類模板的成員函數(shù)

                  類模板的靜態(tài)數(shù)據(jù)成員

                  類模板的成員類

                  類或類模板的成員類模板

                  member class template of a class or class template

                  未刪除 類或類的成員函數(shù)模板模板

                  non-deleted member function template of a class or class template

                  可以聲明...

                  現(xiàn)在標(biāo)準(zhǔn)草案的現(xiàn)狀N4527 是 14.7.3 顯式特化 [temp.expl.spec]:

                  Now the current state of the draft standard N4527 is 14.7.3 Explicit specialization [temp.expl.spec]:

                  1 以下任何一項(xiàng)的明確特化:

                  1 An explicit specialization of any of the following:

                  (1.1) — 函數(shù)模板

                  (1.1) — function template

                  (1.2) — 類模板

                  (1.2) — class template

                  (1.3) — 變量模板

                  (1.3) — variable template

                  (1.4) — 類模板的成員函數(shù)

                  (1.4) — member function of a class template

                  (1.5) — 類模板的靜態(tài)數(shù)據(jù)成員

                  (1.5) — static data member of a class template

                  (1.6) — 類模板的成員類

                  (1.6) — member class of a class template

                  (1.7) — 類模板的成員枚舉

                  (1.7) — member enumeration of a class template

                  (1.8) — 類或類模板的成員類模板

                  (1.8) — member class template of a class or class template

                  (1.9) — 類或類模板的成員函數(shù)模板

                  (1.9) — member function template of a class or class template

                  ...

                  所以我猜:

                  template<typename T>
                  void foo() = delete;
                  
                  template<>
                  void foo<int>(){}
                  
                  int main() {
                      foo<int>();
                      return 0;
                  }
                  

                  是 C++11 標(biāo)準(zhǔn)兼容代碼,應(yīng)該被接受.

                  Is C++11 standard compatible code and should be accepted.

                  這篇關(guān)于刪除“通用"的專用模板函數(shù)案例無法使用 g++ &lt;=4.8.0 和 clang++ 編譯的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Why do two functions have the same address?(為什么兩個(gè)函數(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(我什么時(shí)候應(yīng)該使用關(guān)鍵字“typename?使用模板時(shí))
                  Dependent name resolution amp; namespace std / Standard Library(依賴名稱解析命名空間 std/標(biāo)準(zhǔn)庫(kù))
                  gcc can compile a variadic template while clang cannot(gcc 可以編譯可變參數(shù)模板,而 clang 不能)

                        <bdo id='Tv94z'></bdo><ul id='Tv94z'></ul>
                          <tbody id='Tv94z'></tbody>

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

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

                            主站蜘蛛池模板: 黄 色 毛片免费 | 一区二区亚洲 | av一区二区在线观看 | 欧美黄色免费网站 | 午夜影院在线视频 | 成年人在线 | 国产乱码精品1区2区3区 | 亚洲一区二区精品 | 国产精品久久久久久亚洲调教 | 久久久久久黄 | 成人午夜在线 | 国产又色又爽又黄又免费 | 蜜臀久久99精品久久久久野外 | 国产精品久久久久一区二区三区 | 午夜电影福利 | 日韩中文一区 | 免费观看一级特黄欧美大片 | 国产精品福利久久久 | 欧美亚洲国产成人 | aaa精品| 成人性视频在线播放 | 男女污污动态图 | 久久久久久国产精品免费免费狐狸 | 国产乱码精品一区二区三区中文 | 国产精品一区二区在线播放 | 国产一区二区三区在线看 | 亚洲国产成人精品在线 | 国内精品久久久久 | 久久国产精品一区二区 | 91精品国产高清一区二区三区 | 欧美激情黄色 | 国产精品一区二区欧美黑人喷潮水 | 天天综合国产 | 最近中文字幕第一页 | 99综合| av网站在线播放 | 亚洲黄色一区二区三区 | 国产乱码久久久久久 | 国产精品久久久 | 久久一热 | 毛片在线视频 |