STL Algorithm

headkio·2020년 9월 11일
0

C++

목록 보기
16/35
post-thumbnail

STL Algorithm ?

  • 요소 범위에서 쓸 수 있는 함수들
  • 배열 or 몇 STL Container에서 사용 가능
  • 반복자를 통해 접근
  • Container의 크기를 변경하지 않음

유형

  1. 변경 불가
    find(), for_each() ...

  2. 변경 가능
    copy(), swap() ...

  3. 정렬
    sort(), merge() ...

  4. 수치
    accumulate() ...

copy

from부터 to까지를 destination에 복사.

#include <algorithm>

int main() 
{
  std:copy(iterator from, iterator to, iterator destination);
}

참고

http://www.cplusplus.com/reference/algorithm/

profile
돌아서서 잊지말고, 잘 적어 놓자

0개의 댓글