STL - Container/Container - Array
Array - max_size()
Programmer.
2016. 1. 28. 17:57
소스)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #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}; std::array<int, Max_Size>::size_type Size = Array.max_size(); print(Array);; std::cout << Array.max_size() << std::endl; std::cout << Size << std::endl; print(Array); } | cs |
내용)
array에 들어갈 수 있는 데이터 최대 갯 수를 리턴합니다. 배열은 정해져있기 때문에 그 정한 크기를 리턴하게 됩니다.
결과)