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

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

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

        • <bdo id='coSrJ'></bdo><ul id='coSrJ'></ul>

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

      2. 我可以將 C++17 無捕獲 lambda constexpr 轉換運算符的

        Can I use the result of a C++17 captureless lambda constexpr conversion operator as a function pointer template non-type argument?(我可以將 C++17 無捕獲 lambda constexpr 轉換運算符的結果用作函數指針模板非類型參數嗎
          <tfoot id='ZpT9G'></tfoot>

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

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

                  <tbody id='ZpT9G'></tbody>
                  <bdo id='ZpT9G'></bdo><ul id='ZpT9G'></ul>
                • 本文介紹了我可以將 C++17 無捕獲 lambda constexpr 轉換運算符的結果用作函數指針模板非類型參數嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  在回答我該怎么做編寫一個看起來像方法的 lambda 表達式?,我試圖通過利用以下事實將無捕獲的 lambda 轉換為成員函數指針,因為自 C++17 起,無捕獲的 lambda 具有 constexpr 將運算符轉換為其函數指針類型.

                  While answering How do I write a lambda expression that looks like a method?, I tried to turn a captureless lambda into a member function pointer by exploiting the fact that, since C++17, captureless lambdas have a constexpr conversion operator to their function pointer type.

                  所以我想出了一個問題:

                  So I came up with an issue boiling down to:

                  template<void(*)()> struct A{};
                  
                  int main()
                  {
                    A<static_cast<void(*)()>([]{})>{}; // 1
                  
                    constexpr auto fp = static_cast<void(*)()>([]{});
                    A<fp>{}; // 2
                  }
                  

                  現在,這在 clang(自 5.0.0 起)中編譯,但 gcc(>=7.2) 抱怨:

                  Now, this compiles in clang (since 5.0.0) but gcc(>=7.2) complains:

                  error: lambda-expression in template-argument
                     A<static_cast<void(*)()>([]{ /*whatever*/ })>{}; // 1
                                              ^
                  error: 'main()::<lambda()>::_FUN' is not a valid template argument for type 'void (*)()' because 'static constexpr void main()::<lambda()>::_FUN()' has no linkage
                     A<fp>{}; // 2
                  

                  問題是,誰是對的?

                  推薦答案

                  這是一個 gcc 錯誤,已提交 83258.

                  This is a gcc bug, filed 83258.

                  在 C++14 中,我們曾經有一個 鏈接要求指針類型的非類型模板參數.但是在 C++17 中(由于 N4268),參數只需要一個轉換正確類型的常量表達式,還有一些其他限制(此處均不相關).一旦我們可以構造fp,我們就應該能夠將其用作模板參數.

                  In C++14, we used to have a linkage requirement for non-type template parameters of pointer type. But in C++17 (as a result of N4268), the parameter just needs to be a converted constant expression of the correct type, with a few other restrictions (none of which are relevant here). Once we can construct fp, we should be able to use it as a template parameter.

                  這篇關于我可以將 C++17 無捕獲 lambda constexpr 轉換運算符的結果用作函數指針模板非類型參數嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='JqIYv'></small><noframes id='JqIYv'>

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

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

                      • <bdo id='JqIYv'></bdo><ul id='JqIYv'></ul>
                            <tbody id='JqIYv'></tbody>

                          • 主站蜘蛛池模板: 久久大陆| 亚洲一二三在线 | 国产精品久久精品 | 欧美日日日日bbbbb视频 | 成人福利在线观看 | 欧美xxxx在线 | 夜夜骑首页| 香蕉婷婷| 久草网站 | 国产乱码精品一区二区三区av | 欧美精品一区二区三区在线播放 | 中文字幕亚洲一区 | 午夜亚洲| 黑人一级黄色大片 | 亚洲视频中文字幕 | 亚洲精品国产电影 | 99精品亚洲国产精品久久不卡 | 一区二区成人 | 天天干视频网 | 国户精品久久久久久久久久久不卡 | 国产一区二区久久久 | av国产精品毛片一区二区小说 | 久草影视在线 | 成人免费淫片aa视频免费 | 日韩国产在线 | 观看av | 久久精品色欧美aⅴ一区二区 | 亚洲欧美一区二区三区在线 | 男人的天堂在线视频 | 国产xxxx搡xxxxx搡麻豆 | 六月婷婷久久 | 欧美精品a∨在线观看不卡 欧美日韩中文字幕在线播放 | 亚洲色欲色欲www | 伊人超碰 | 久久国产精品-国产精品 | 羞羞视频网站免费看 | 久久免费大片 | 久久午夜精品福利一区二区 | 丁香综合 | 久久精品一区 | 伦理午夜电影免费观看 |