< STL >
- Standard Template Library (STL) : library of classes and associated functions
- ํ๊ตญ์ด๋ก๋ ํ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ผ๊ณ ํ๋ค.
- template-based components ๋ฅผ ํตํด software reuse์ ํจ. -> ์ด๋ ํ์ ์ ์ผ๋ฐํ๋ก ๋งํ ์์์
: which is "GENERIC PROGRAMMING ! " ( vs functional programming - ํจ์ํ ํ๋ก๊ทธ๋๋ฐ)
<STL ์ ๊ตฌ์ฑ์์>
1. Containers : ์ปจํ ์ด๋
- Data structures capable of storing objects of almost any data type (there are some restrictions)
- ํํ stl ์๋ฃ๊ตฌ์กฐ๋ผ๋ ๊ฒ์ด stl container์ผ๋ก ํต์ฉ๋๋ค. (์ปฌ๋ ์ ์ด๋ผ ์นญํ๋ ๊ฒฝ์ฐ๋ ์์)
2. Iterators ( -> objects) : ๋ฐ๋ณต์
- Used to step through the elements of a container
- ํฌ์ธํฐ ๊ฐ์๊ฑฐ
3. Algorithms ( = non-member functions) : ์๊ณ ๋ฆฌ์ฆ
- Functions that perform common data maniputation such as sorting, searching, and comparing elements (or entire contatiners)
- sorting, searching, comparing ๊ฐ์ ์ผ๋ฐ์ ์ธ ํด๊ฒฐ๋ฐฉ๋ฒ์ ๊ท๊ฒฉํ - ํ์ํ ํด๋์ ๋ฐฉ๋ฒ??
<STL ์ ์ฅ์ >
- ๊ฐ๊ฐํฐ ๋น ๋ฅด๋ค
- ์ง์ฌ์ ธ ์๋ ํ ํ๋ฆฟ์ ์ ์ฌ์ ์์ ๋ฃ์ผ๋ฉด ๋๊ธฐ ๋๋ฌธ์ ํจ์จ์ฑ์ด ๋ฌด์๊ฒ ์ฌ๋ผ๊ฐ๋ค
.. ๋จ์ ์ ์์ง ๋ชจ๋ฅด๊ฒ์ ใ . ( ๊ทธ์น๋ง ์๋ง Generic programming์ ๋จ์ ์ด ๊ทธ๋๋ก ๊ฐ์ง์์๊น ํ๋ ์๊ฐ์ด ๋ ๋ค)
![](https://t1.daumcdn.net/keditor/emoticon/friends1/large/001.gif)
๋ค์์ STL์ Iterator์ ๋ํด์ ์๋ผ๋ณด์
'เซฎโหถแต แต แตหถโแโก > coding' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[C++] iterator's function (0) | 2024.03.29 |
---|---|
[C++] STL์ ๋ฐ๋ณต์ (Iterators) (0) | 2024.03.28 |
[C++] ์ด๋ก ๊ณต๋ถ ์ค๋ต๋ ธํธ 1 (0) | 2023.09.22 |
[C++] Introduction to C++ Syntax & Variables (0) | 2023.09.22 |
[c++] idioms (0) | 2023.09.22 |