官术网_书友最值得收藏!

Code walkthrough

The following line declares an array of a fixed size (5) and initializes the array with five elements:

array<int,5> a = { 1, 5, 2, 4, 3 };

The size mentioned can't be changed once declared, just like a C/C++ built-in array. The array::size() method returns the size of the array, irrespective of how many integers are initialized in the initializer list. The auto pos = a.begin() method declares an iterator of array<int,5> and assigns the starting position of the array. The array::end() method points to one position after the last element in the array. The iterator behaves like or mimics a C++ pointer, and dereferencing the iterator returns the value pointed by the iterator. The iterator position can be moved forward and backwards with ++pos and --pos, respectively.

主站蜘蛛池模板: 遂宁市| 阜宁县| 玛多县| 肥东县| 桂东县| 左贡县| 扎兰屯市| 合山市| 嘉义县| 商都县| 宿州市| 龙山县| 浠水县| 揭西县| 呼图壁县| 视频| 青海省| 伊宁市| 敖汉旗| 阜平县| 拉萨市| 宁南县| 蓬安县| 威信县| 汤阴县| 莱西市| 阳高县| 镇安县| 固始县| 河北区| 宾川县| 南康市| 昭通市| 达孜县| 互助| 南平市| 布拖县| 文水县| 兖州市| 腾冲县| 云阳县|