STL 알고리듬(Algorithm)

2020. 8. 12. 01:30프로그래밍/C++

STL 알고리듬이란?

 

요소 범위에서 쓸 수 있는 함수들

> [처음, 마지막)   (처음 포함 마지막 미포함)

배열 또는 몇몇 STL 컨테이너에 쓸 수 있음

반복자를 통해 컨테이너에 접근

컨테이너의 크기를 변경하지 않음

> 따라서 추가 메모리 할당도 없음


STL 알고리듬의 유형

 

#include <algorithm>

> 변경 불가 순차(sequence) 연산 : find(), for_each(), ...

> 변경 가능 순차 연산 : copy(), swap(), ...

> 정렬 관련 연산 : sort(), merge(), ...

 

#include <numeric>

> 범용 수치 연산 : accumulate(), ...


STL 알고리듬 목록

 

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

 

- C++ Reference

library Standard Template Library: Algorithms The header defines a collection of functions especially designed to be used on ranges of elements. A range is any sequence of objects that can be accessed through iterators or pointers, such as an a

www.cplusplus.com

 

 

출처 : 포큐아카데미 C++ 언매니지드 프로그래밍