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
- 시스템프로그래밍
- priority_queue
- Stack
- 수광 소자
- 운영체제
- map
- stl
- LineTracer
- 아두이노 소스
- Arduino
- Array
- 자료구조
- set
- 아두이노 컴파일러
- 통계학
- Visual Micro
- 아두이노
- queue
- c++
- Deque
- html
- 라인트레이서
- vector
- arduino compiler
- 컴퓨터 그래픽스
- list
- Algorithm
- WinAPI
- C언어
- directx
Archives
- Today
- Total
Kim's Programming
List - empty() 본문
소스)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include<list> #include<iostream> void print(std::list<int> Target_List) { for (std::list<int>::iterator IterPos = Target_List.begin(); IterPos != Target_List.end(); ++IterPos) std::cout << *IterPos << " "; std::cout << std::endl; } void main() { std::list<int> List = { 1,2,3,4,100,101,102,103 }; print(List); if (List.empty()) std::cout << "리스트가 비었습니다." << std::endl; else std::cout << "리스트에 데이터가 있습니다." << std::endl; print(List); } | cs |
내용)
empty()함수는 list가 비었을 경우 true를 리턴하고 데이터가 하나라도 있을 경우에는 false를 리턴합니다.
결과)
'STL - Container > Container - List' 카테고리의 다른 글
List - erase() (0) | 2016.01.29 |
---|---|
List - end() (0) | 2016.01.29 |
List - emplace_front() (0) | 2016.01.29 |
List - emplace_back() (0) | 2016.01.29 |
List - emplace() (0) | 2016.01.28 |