STL - Container/Container - Array
Array - cbegin()
Programmer.
2016. 1. 28. 16:58
소스)
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.cbegin(); std::cout << *constIter << std::endl; print(Array); } | cs |
내용)
cbegin() 함수는 첫 데이터를 가리키는 const Iterator 형태의 반복자를 리턴하는 함수입니다.
결과)