https://github.com/solareenlo/42cpp_module_08_2021
CPP Module 08
https://github.com/solareenlo/42cpp_module_08_2021
42 42born2code 42cursus cpp98
Last synced: 4 months ago
JSON representation
CPP Module 08
- Host: GitHub
- URL: https://github.com/solareenlo/42cpp_module_08_2021
- Owner: solareenlo
- Created: 2021-11-17T14:22:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-24T13:06:00.000Z (over 3 years ago)
- Last Synced: 2024-12-30T09:16:08.712Z (5 months ago)
- Topics: 42, 42born2code, 42cursus, cpp98
- Language: C++
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 42CPP_Module_08_2021
[](https://app.codacy.com/gh/solareenlo/42CPP_Module_08_2021?utm_source=github.com&utm_medium=referral&utm_content=solareenlo/42CPP_Module_08_2021&utm_campaign=Badge_Grade_Settings)
[](https://github.com/solareenlo/42CPP_Module_08_2021/actions/workflows/reviewdog.yml)
[](https://github.com/solareenlo/42CPP_Module_08_2021/actions/workflows/cpplint.yml)
[](https://github.com/solareenlo/42CPP_Module_08_2021/actions/workflows/sanitizer.yml)
[](https://github.com/solareenlo/42CPP_Module_08_2021/actions/workflows/valgrind.yml)
[](https://github.com/solareenlo/42CPP_Module_08_2021/actions/workflows/make_on_linux.yml)## ex02
- [library Containers](https://www.cplusplus.com/reference/stl/)
- [std::stack cplusplus](https://www.cplusplus.com/reference/stack/stack/)
- [std::stack cppreference](https://en.cppreference.com/w/cpp/container/stack)- stack はコンテナアダプタと言って,別に標準で実装されているコンテナを改良して作られるコンテナである
- stack はデフォルトでは `deque` をもとに,`bakc()`, `push_back()`, `pop_back()`, `emplace_back()` が使えるようにされている.
- stack が使用している元となるコンテナは `container_type` で定義されている
- stack のソースコードを見てみると良い
- mac の stack のソースコードでは
```c++
protected:
container_type c;
```
と定義されているので,`std::stack::c.begin()` とか,`std::stack::c.end()` とすれば,stack の元となるコンテナの `begin()`, `end()` が使えて,先頭と最後にアクセスできる- ので,stack で iterator を無理やり使いたい場合は,元となるコンテナの iterator を使えば良い.
## ex01
- [iteratorとconst_iteratorとconst interator](https://qiita.com/_EnumHack/items/a3724dead343b5aecb4e#iterator%E3%81%A8const_iterator%E3%81%A8const-interator)
- [std::vectorは使えないのか?](https://qiita.com/HO-RI9191/items/6f761af23cf5d288cb9e)
- vector, sort, vector::begin, vector::front, vector::back## ex00
- [std::find cplusplus](https://www.cplusplus.com/reference/algorithm/find/)
- [Containers library](https://en.cppreference.com/w/cpp/container)