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 | 31 |
Tags
- 컴퓨터 그래픽스
- stl
- list
- Deque
- c++
- 시스템프로그래밍
- set
- 아두이노
- arduino compiler
- Array
- 운영체제
- html
- 자료구조
- queue
- 라인트레이서
- Arduino
- Algorithm
- Stack
- priority_queue
- 아두이노 컴파일러
- WinAPI
- LineTracer
- 통계학
- Visual Micro
- 아두이노 소스
- C언어
- vector
- directx
- 수광 소자
- map
Archives
- Today
- Total
Kim's Programming
Array - cend() 본문
소스)
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_iterator constIter = Array.cend(); std::cout << *(--constIter) << std::endl; print(Array); } | cs |
내용)
cend()함수는 마지막 데이터 바로 다음을 가리키고 있는 이터레이터 입니다. cend() 자체를 출력하면 배열을 벗어나기 때문에 --연산자를 이용하여 앞으로 한칸 땡겨서 출력을 해 줍니다.
결과)
'STL - Container > Container - Array' 카테고리의 다른 글
Array - crend() (0) | 2016.01.28 |
---|---|
Array - crbegin() (0) | 2016.01.28 |
Array - cbegin() (0) | 2016.01.28 |
Array - begin() (0) | 2016.01.28 |
Array - back() (0) | 2016.01.28 |