컨테이너 어댑터 - 우선순위 큐 (Priority Queue)

Checking·2021년 2월 26일
0

STL 컨테이너

목록 보기
17/17
post-thumbnail

헤더 파일 : <queue>

  • 우선 순위에 따라 정렬된 Queue.

특징
- 큐에 있는 원소를 처리할 때 가장 먼저 들어온 원소를 먼저 처리하는 것이 아닌
우선순위가 가장 높은 원소가 먼저 처리된다.


생성자
priority_queue <data_type, container_type, sorting_type> priority_queue_name

FunctionDescription
.push(value)맨 뒤에 value 삽입
.pop()우선순위가 가장 높은 원소 삭제
(기본은 가장 높은 값)
.size()원소의 개수 반환
.empty()비었을 시 true 반환
.top()우선순위가 가장 높은 원소 반환
.swap(another_priority_queue)another_priority_queue와 바꿈
profile
(ง ᐖ)ว

0개의 댓글