Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- WinAPI
- vector
- c++
- set
- directx
- 컴퓨터 그래픽스
- C언어
- 아두이노
- Stack
- 시스템프로그래밍
- Algorithm
- queue
- 아두이노 소스
- 수광 소자
- Array
- 아두이노 컴파일러
- priority_queue
- 자료구조
- 통계학
- 운영체제
- map
- arduino compiler
- LineTracer
- stl
- list
- html
- 라인트레이서
- Deque
- Arduino
- Visual Micro
Archives
- Today
- Total
Kim's Programming
Array - crend() 본문
소스)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include<array> #include<iostream> #define Max_Size 10 void print(std::array<int, Max_Size> Target_Array) { for (std::array<int, Max_Size>::iterator IterPos = Target_Array.begin(); IterPos != Target_Array.end(); ++IterPos) std::cout << *IterPos << " "; std::cout << std::endl; } void main() { std::array<int, Max_Size > Array = { 1,3,5,7,9,11,13,15,17,19}; print(Array); std::array<int, Max_Size>::const_reverse_iterator crIter = Array.crend(); std::cout << *(--crIter) << std::endl; print(Array); } | cs |
내용)
crend()함수는 거꾸로 본 array에서 가장 마지막에 있는 데이터 바로 다음을 가리키게 됩니다. 그렇기 때문에 마지막 바로 이전을 가리키게해서 출력을 하였습니다. 원래 array에서 보았을때 crend()의 위치는 첫 데이터 이전을 가리키고 있는 것이 됩니다.
결과)
'STL - Container > Container - Array' 카테고리의 다른 글
Array - empty() (0) | 2016.01.28 |
---|---|
Array - data() (0) | 2016.01.28 |
Array - crbegin() (0) | 2016.01.28 |
Array - cend() (0) | 2016.01.28 |
Array - cbegin() (0) | 2016.01.28 |