久久久久久久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>
                • 本文介紹了如何定義遞歸概念?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  cppreference.com 指出:

                  概念不能遞歸地引用自己

                  Concepts cannot recursively refer to themselves

                  但是我們?nèi)绾味x一個(gè)概念來表示整數(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;
                  

                  而且這個(gè)特征可以遞歸:

                  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)于如何定義遞歸概念?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  In what ways do C++ exceptions slow down code when there are no exceptions thown?(當(dāng)沒有異常時(shí),C++ 異常會(huì)以何種方式減慢代碼速度?)
                  Why catch an exception as reference-to-const?(為什么要捕獲異常作為對(duì) const 的引用?)
                  When and how should I use exception handling?(我應(yīng)該何時(shí)以及如何使用異常處理?)
                  Scope of exception object in C++(C++中異常對(duì)象的范圍)
                  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>
                            主站蜘蛛池模板: 这里精品| 中文字幕一区二区三区四区五区 | 麻豆久久久久久 | av久久| 亚洲精品国产成人 | 日韩在线精品 | 九色av | www.99热| 精品自拍视频在线观看 | 中文字字幕一区二区三区四区五区 | 国产一区| 91av视频在线观看 | 欧美成人久久 | 国产乱码精品一品二品 | 欧美国产日韩在线 | 亚洲成人一区二区三区 | 精品一区二区三区在线观看 | 99热视| 超碰3| 日本特黄a级高清免费大片 特黄色一级毛片 | 久久丁香| 国产精品自拍一区 | 97精品超碰一区二区三区 | 日本不卡视频在线播放 | 在线免费观看日本 | 国久久| 一本一道久久a久久精品蜜桃 | 精品欧美一区二区三区久久久 | 久久99国产精品 | 日韩视频在线免费观看 | 色又黄又爽网站www久久 | 欧美一二三四成人免费视频 | 人操人免费视频 | 国产99精品| 高清欧美性猛交xxxx黑人猛交 | 极品一区 | 久草综合在线视频 | 成人在线一区二区 | 亚洲狠狠爱 | 老司机67194精品线观看 | 麻豆av片 |