Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9430b41
commit d6e40dd
Showing
3 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# clear | ||
* flat_map[meta header] | ||
* std[meta namespace] | ||
* flat_map[meta class] | ||
* function[meta id-type] | ||
* cpp23[meta cpp] | ||
|
||
```cpp | ||
void clear() noexcept; // (1) C++23 | ||
``` | ||
|
||
## 概要 | ||
コンテナ内の全ての要素を削除する。それぞれのデストラクタが呼ばれ、コンテナから削除される。[`size()`](size.md) は 0 になる。 | ||
|
||
|
||
## 計算量 | ||
線形時間 | ||
|
||
|
||
## 例外 | ||
|
||
投げない | ||
|
||
## 例 | ||
```cpp example | ||
#include <iostream> | ||
#include <flat_map> | ||
|
||
int main () | ||
{ | ||
std::flat_map<int, char> fm = { | ||
{3, 'C'}, | ||
{4, 'D'}, | ||
{1, 'A'}, | ||
{2, 'B'}, | ||
}; | ||
|
||
std::cout << fm.size() << std::endl; | ||
|
||
fm.clear(); | ||
|
||
std::cout << fm.size() << std::endl; | ||
} | ||
``` | ||
* clear()[color ff0000] | ||
* fm.size()[link size.md] | ||
|
||
### 出力 | ||
``` | ||
4 | ||
0 | ||
``` | ||
|
||
## バージョン | ||
### 言語 | ||
- C++23 | ||
|
||
### 処理系 | ||
- [Clang](/implementation.md#clang): ?? | ||
- [GCC](/implementation.md#gcc): ?? | ||
- [Visual C++](/implementation.md#visual_cpp): ?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters