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

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

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

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

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

        如何定義遞歸概念?

        How to define a recursive concept?(如何定義遞歸概念?)

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

      2. <tfoot id='mrxeI'></tfoot>
        <legend id='mrxeI'><style id='mrxeI'><dir id='mrxeI'><q id='mrxeI'></q></dir></style></legend>
        • <bdo id='mrxeI'></bdo><ul id='mrxeI'></ul>

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

                    <tbody id='mrxeI'></tbody>
                • 本文介紹了如何定義遞歸概念?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  cppreference.com 指出:

                  概念不能遞歸地引用自己

                  Concepts cannot recursively refer to themselves

                  但是我們?nèi)绾味x一個概念來表示整數(shù)或整數(shù)向量,或整數(shù)向量的向量等.

                  But how can we define a concept that will represent an integer or a vector of integers, or a vector of vector of integers, etc.

                  我可以擁有這樣的東西:

                  I can have something this:

                  template < typename Type > concept bool IInt0 = std::is_integral_v<Type>;
                  template < typename Type > concept bool IInt1 = IInt0<Type> || requires(Type tt) { {*std::begin(tt)} -> IInt0; };
                  template < typename Type > concept bool IInt2 = IInt1<Type> || requires(Type tt) { {*std::begin(tt)} -> IInt1; };
                  
                  static_assert(IInt2<int>);
                  static_assert(IInt2<std::vector<int>>);
                  static_assert(IInt2<std::vector<std::vector<int>>>);
                  

                  但我想要像 IIntX 這樣的東西,這意味著任何 N 的 IIntN.

                  But I want to have something like IIntX that will mean IIntN for any N.

                  有可能嗎?

                  推薦答案

                  概念總是可以遵從類型特征:

                  Concepts can always defer to a type trait:

                  template <typename T> concept C = some_trait<T>::value;
                  

                  而且這個特征可以遞歸:

                  And that trait can be recursive:

                  template <typename T>
                  struct some_trait : std::false_type { };
                  
                  template <std::Integral T>
                  struct some_trait<T> : std::true_type { };
                  
                  template <typename T, typename A>
                  struct some_trait<std::vector<T, A>> : some_trait<T> { };
                  

                  如果你的意思不只是vector,那么最后的部分特化可以推廣為:

                  If you don't mean just vector, then the last partial specialization can be generalized to:

                  template <std::Range R>
                  struct some_trait<R> : some_trait<std::range_value_t<R>> { };
                  

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

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

                  相關(guān)文檔推薦

                  In what ways do C++ exceptions slow down code when there are no exceptions thown?(當(dāng)沒有異常時,C++ 異常會以何種方式減慢代碼速度?)
                  Why catch an exception as reference-to-const?(為什么要捕獲異常作為對 const 的引用?)
                  When and how should I use exception handling?(我應(yīng)該何時以及如何使用異常處理?)
                  Scope of exception object in C++(C++中異常對象的范圍)
                  Catching exceptions from a constructor#39;s initializer list(從構(gòu)造函數(shù)的初始化列表中捕獲異常)
                  Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 說明符 C++11 noexcept 之間的區(qū)別)
                  <tfoot id='cEIkr'></tfoot>
                  <i id='cEIkr'><tr id='cEIkr'><dt id='cEIkr'><q id='cEIkr'><span id='cEIkr'><b id='cEIkr'><form id='cEIkr'><ins id='cEIkr'></ins><ul id='cEIkr'></ul><sub id='cEIkr'></sub></form><legend id='cEIkr'></legend><bdo id='cEIkr'><pre id='cEIkr'><center id='cEIkr'></center></pre></bdo></b><th id='cEIkr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cEIkr'><tfoot id='cEIkr'></tfoot><dl id='cEIkr'><fieldset id='cEIkr'></fieldset></dl></div>
                    <tbody id='cEIkr'></tbody>

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

                          • <small id='cEIkr'></small><noframes id='cEIkr'>

                          • <legend id='cEIkr'><style id='cEIkr'><dir id='cEIkr'><q id='cEIkr'></q></dir></style></legend>
                            主站蜘蛛池模板: 成人在线视频观看 | 欧美日韩少妇 | 黄色一级视频网站 | 亚洲不卡 | 欧美国产激情 | 饥渴放荡受np公车奶牛 | 羞羞网站在线观看 | 中文字幕在线观看第一页 | 久久精品免费看 | 伊人9999| av片在线观看 | 国产精品美女在线观看 | 久久精品播放 | 99久久99| 欧美又大粗又爽又黄大片视频 | 欧美自拍一区 | 国产精品看片 | 日韩一区二区三区四区 | 视频一区在线观看 | 国产精品一区二区在线免费观看 | 国产精品视频一区二区三区 | 久久手机免费视频 | 一区二区三区四区精品 | 精品久久影院 | 久久理论片 | 手机看片福利永久 | 爱搞逼综合网 | 久久不射网 | 亚洲免费大片 | 久久精品国产一区 | 国产精品乱码一区二区三区 | 国产91丝袜在线播放 | 天天干天天操天天摸 | 国产高清网站 | 亚洲精品久 | 亚洲视频在线免费观看 | 免费av一区 | 国产麻豆xxxvideo实拍 | 韩国精品在线 | 久久久久黄色 | 在线亚洲精品 |