<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 序列for循環語句 C++11中引入了序列for循環以實現區間遍歷的簡化。這里所謂的區間可以是任一種能用迭代器遍歷的區間,例如STL中由begin()和end()定義的序列。所有的標準容器,例如std::string、 初始化列表、數組,甚至是istream,只要定義了begin()和end()就行。 這里是一個序列for循環語句的例子: ``` void f(const vector& v) { for (auto x : v) cout << x << ‘n’; for (auto& x : v) ++x; // 使用引用,方便我們修改容器中的數據 } ``` 可以這樣理解這里的序列for循環語句,“對于v中的所有數據元素x”,循環由v.begin()開始,循環到v.end()結束。又如: ``` for (const auto x : { 1,2,3,5,8,13,21,34 }) cout << x << ‘n’; ``` begin()函數(包括end()函數)可以是成員函數通過x.begin()方式調用,或者是獨立函數通過begin(x)方式調用。 (譯注:好像C#中早就有這種形式的for循環語句,用于遍歷一個容器中的所有數據很方便,難道C++是從C#中借用過來的?) 或參見: * the C++ draft section 6.5.4 (note: changed not to use concepts) * [N2243==07-0103] Thorsten Ottosen: [Wording for range-based for-loop (revision 2)](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2243.html). * [N3257=11-0027 ] Jonathan Wakely and Bjarne Stroustrup: [Range-based for statements and ADL](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3257.pdf) (Option 5 was chosen).
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看