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

<small id='7wtxZ'></small><noframes id='7wtxZ'>

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

      <bdo id='7wtxZ'></bdo><ul id='7wtxZ'></ul>

  2. <legend id='7wtxZ'><style id='7wtxZ'><dir id='7wtxZ'><q id='7wtxZ'></q></dir></style></legend>

      什么是半開范圍和離終值

      What is half open range and off the end value(什么是半開范圍和離終值)

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

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

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

              <tbody id='C1BES'></tbody>
            <legend id='C1BES'><style id='C1BES'><dir id='C1BES'><q id='C1BES'></q></dir></style></legend>

              <tfoot id='C1BES'></tfoot>
              1. 本文介紹了什么是半開范圍和離終值的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                這些術語在 C++ 中是什么意思?

                What do these terminologies mean in C++?

                1. 關閉 end

                2. 半開范圍 - [begin, off_the_end)

                我在閱讀 for 循環時遇到了它們.

                I came across them while reading about for loops.

                推薦答案

                半開范圍是包含第一個元素但不包括最后一個元素的范圍.

                A half-open range is one which includes the first element, but excludes the last one.

                范圍 [1,5) 是半開的,由值 1、2、3 和 4 組成.

                The range [1,5) is half-open, and consists of the values 1, 2, 3 and 4.

                結束"或結束"指的是序列末尾之后的元素,它的特殊之處在于允許迭代器指向它(但您可能不會查看實際值,因為它不存在)

                "off the end" or "past the end" refers to the element just after the end of a sequence, and is special in that iterators are allowed to point to it (but you may not look at the actual value, because it doesn't exist)

                例如,在以下代碼中:

                char arr[] = {'a', 'b', 'c', 'd'};
                
                char* first = arr
                char* last = arr + 4;
                

                first 現在指向數組的第一個元素,而 last 指向數組末尾的一個元素.我們可以指向數組末尾的一個(但不能兩個過去),但我們不能嘗試訪問該位置的元素:

                first now points to the first element of the array, while last points one past the end of the array. We are allowed to point one past the end of the array (but not two past), but we're not allowed to try to access the element at that position:

                // legal, because first points to a member of the array
                char firstChar = *first;
                // illegal because last points *past* the end of the array
                char lastChar = *last;
                

                我們的兩個指針 firstlast 共同定義了一個范圍,即它們之間的所有元素.

                Our two pointers, first and last together define a range, of all the elements between them.

                如果是半開區間,則包含first指向的元素,以及中間的所有元素,但不包含last指向的元素(這很好,因為它實際上并不指向有效元素)

                If it is a half open range, then it contains the element pointed to by first, and all the elements in between, but not the element pointed to by last (which is good, because it doesn't actually point to a valid element)

                在 C++ 中,所有標準庫算法都在這種半開范圍內運行.例如,如果我想將整個數組復制到其他位置 dest,我會這樣做:

                In C++, all the standard library algorithms operate on such half open ranges. For example, if I want to copy the entire array to some other location dest, I do this:

                std::copy(first, last, dest)
                

                一個簡單的 for 循環通常遵循類似的模式:

                A simple for-loop typically follows a similar pattern:

                for (int i = 0; i < 4; ++i) {
                    // do something with arr[i]
                }
                

                這個循環從 0 到 4,但不包括結束值,所以覆蓋的索引范圍是半開,特別是 [0, 4)

                This loop goes from 0 to 4, but it excludes the end value, so the range of indices covered is half-open, specifically [0, 4)

                這篇關于什么是半開范圍和離終值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                In what ways do C++ exceptions slow down code when there are no exceptions thown?(當沒有異常時,C++ 異常會以何種方式減慢代碼速度?)
                Why catch an exception as reference-to-const?(為什么要捕獲異常作為對 const 的引用?)
                When and how should I use exception handling?(我應該何時以及如何使用異常處理?)
                Scope of exception object in C++(C++中異常對象的范圍)
                Catching exceptions from a constructor#39;s initializer list(從構造函數的初始化列表中捕獲異常)
                Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 說明符 C++11 noexcept 之間的區別)

                      <bdo id='KDeUh'></bdo><ul id='KDeUh'></ul>
                      <tfoot id='KDeUh'></tfoot>
                        <tbody id='KDeUh'></tbody>

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

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

                        2. 主站蜘蛛池模板: 日韩一区二区av | 久久成人高清视频 | 亚洲一区二区综合 | 成人h免费观看视频 | 日韩手机在线视频 | 精品婷婷 | 欧美日韩电影免费观看 | 91成人免费电影 | 狠狠色香婷婷久久亚洲精品 | 亚洲精品二三区 | 日韩at| 日韩成人精品在线 | av中文字幕网站 | 高清av电影 | 日韩福利在线 | 亚洲精品在线视频 | 99久久精品国产一区二区三区 | 黄视频免费在线 | 国产精品久久久久久久久久久免费看 | 成人综合一区二区 | 中文字幕亚洲精品 | 99pao成人国产永久免费视频 | 国产精品久久精品 | 最新中文字幕久久 | 亚洲第一区久久 | 久久国产精品-国产精品 | 欧美日一区二区 | 麻豆国产一区二区三区四区 | 黄色一级毛片 | www.黄色片视频 | 亚欧洲精品在线视频免费观看 | 亚洲欧洲综合av | 在线免费看黄 | 日日日日日日bbbbb视频 | 91精品国产综合久久精品 | 欧美成人精品欧美一级 | 91视频在线观看 | 国产一区二区精 | 国产一区 在线视频 | 噜噜噜噜狠狠狠7777视频 | 国产精品片aa在线观看 |