Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
admiswalker committed Sep 3, 2023
1 parent 9ce6780 commit 667c45d
Showing 1 changed file with 45 additions and 18 deletions.
63 changes: 45 additions & 18 deletions docs_src/docs/src/container/vector/vec_manipulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace sstd{
```

## Description
### remove empty objects / 空のオブジェクトの削除
| Function name | Description |
| ------------- | ----------- |
| rmEmpty () | returns the `std::vector<T>` type which is removed empty objects and .<br>空のオブジェクトを取り除いた `std::vector<T>` 型を返却します. |
Expand All @@ -35,19 +36,27 @@ namespace sstd{
| rmEmpty_l_ow() | removes empty objects from left (head) side and overwrites the results to the input argument.<br>空のオブジェクトを左 (先頭) 側から取り除き,入力を上書きします. |
| rmEmpty_r () | returns as the `std::vector<T>` type which is removed empty objects from right (head) side.<br>空のオブジェクトを右 (末尾) 側から取り除いた `std::vector<T>` 型を返却します. |
| rmEmpty_r_ow() | removes empty objects from right (head) side and overwrites the results to the input argument.<br>空のオブジェクトを右 (末尾) 側から取り除き,入力を上書きします. |
| rmEmpty_ow(arg1, arg2, ...) | removes empty objects and overwrites the results to the input arguments based on the first argment.<br>第一引数のオブジェクトに従って,空のオブジェクトを取り除き,入力を上書きします. |

### remove objects based on a empty vector / 空ベクトルに基づくオブジェクトの削除
| Function name | Description |
| ------------- | ----------- |
| rmEmpty_ow(arg1, arg2, ...) | removes objects and overwrites the results to the input arguments based on the empty elements of the first `std::vector<T>` argment.<br>第一引数の `std::vector<T>` 型が持つ空の要素に従って,オブジェクトを取り除き,入力を上書きします. |

### countup empty objects / 空のオブジェクトの数え上げ
| Function name | Description |
| ------------- | ----------- |
| cntEmpty | returns the number of empty objects.<br>空のオブジェクトの数を返却します. |
| cntEmpty_l | returns the number of empty objects counted from left (head) side.<br>左 (先頭) 側から数えた空のオブジェクトの数を返却します. |
| cntEmpty_r | returns the number of empty objects counted from right (tail) side.<br>右 (末尾) 側から数えた空のオブジェクトの数を返却します. |

## Usage
### remove empty objects / 空のオブジェクトの削除
- <u>**main.cpp**</u>
```cpp
#mdEx: cpp example (in)
#include <sstd/sstd.hpp>

int main(){
printf("--- rmEmpty ---\n");
printf("case1:\n");

// case1_1
Expand Down Expand Up @@ -84,24 +93,42 @@ int main(){
std::vector<std::string> v3_2 = {"", "", "2", "3", "", "5", "", ""};
sstd::rmEmpty_r_ow(v3_2);
sstd::printn( v3_2 );
}
```
- <u>**Execution result**</u>
```
#mdEx: cpp example (out)
```
printf("\n");
//---
printf("case4: multiple arguments\n");

std::vector<std::string> v4_1 = { "", "", "2a", "3a", "", "5a", "", ""};
std::vector<std::string> v4_2 = {"0b", "1b", "2b", "3b", "4b", "5b", "6b", "7b"};
std::vector<std::string> v4_3 = {"0c", "1c", "2c", "3c", "4c", "5c", "6c", "7c"};
sstd::rmEmpty_ow(v4_1, v4_2, v4_3);
sstd::printn( v4_1 );
sstd::printn( v4_2 );
sstd::printn( v4_3 );

printf("\n");
//---
printf("--- cntEmpty ---\n");
### remove objects based on a empty vector / 空ベクトルに基づくオブジェクトの削除
- <u>**main.cpp**</u>
```cpp
#mdEx: cpp example (in)
#include <sstd/sstd.hpp>
int main(){
std::vector<std::string> v1 = { "", "", "2a", "3a", "", "5a", "", ""};
std::vector<std::string> v2 = {"0b", "1b", "2b", "3b", "4b", "5b", "6b", "7b"};
std::vector<std::string> v3 = {"0c", "1c", "2c", "3c", "4c", "5c", "6c", "7c"};
sstd::rmEmpty_ow(v1, v2, v3);
sstd::printn( v1 );
sstd::printn( v2 );
sstd::printn( v3 );
}
```
- <u>**Execution result**</u>
```
#mdEx: cpp example (out)
```

std::vector<std::string> v = {"", "", "2", "3", "", "5", "", ""};
### countup empty objects / 空のオブジェクトの数え上げ
- <u>**main.cpp**</u>
```cpp
#mdEx: cpp example (in)
#include <sstd/sstd.hpp>

int main(){
std::vector<std::string> v = {"", "", "2", "3", "", "5", "", "", ""};

sstd::printn( sstd::cntEmpty (v) );
sstd::printn( sstd::cntEmpty_l(v) );
Expand Down

0 comments on commit 667c45d

Please sign in to comment.