[c++] containers member function 비교 (array, vector, deque, list, stack, queue)

숭글·2023년 5월 19일
0

자주 사용하는 Sequence container와 Container adaptor의 멤버 함수를 비교해봤다.

arrayvectordequeliststackqueue
Iteratorsbeginbeginbeginbegin
endendendend
rbeginrbeginrbeginrbegin
rendrendrendrend
cbegincbegincbegincbegin
cendcendcendcend
crbegincrbegincrbegincrbegin
crendcrendcrendcrend
Capacitysizesizesizesizesizesize
max_sizemax_sizemax_sizemax_size
emptyemptyemptyemptyemptyempty
resizeresizeresize
capacity
reserve
shrink_to_fitshrink_to_fit
Element accessoperator[]operator[]operator[]
atatat
frontfrontfrontfrontfront
backbackbackbackback
datadata
Modifiersfill
swapswapswapswapswapswap
assignassignassign
push_front
pop_front
push_backpush_backpush_back
pop_backpop_backpop_back
pop_front
poppop
top
pushpush
insertinsertinsert
eraseeraseerase
clearclearclear
emplaceemplaceemplaceemplaceemplace
emplace_frontemplace_front
emplace_backemplace_backemplace_back
  • array에만 있는 fill()의 경우 array를 제외한 다른 시퀀스 컨테이너에서는 fill constructor가 구현돼있다.

참고 -> cplusplus.com

profile
Hi!😁 I'm Soongle. Welcome to my Velog!!!

0개의 댓글