From 667c45d2a3ce2f4dcdf1eb30bfe4b83cac6b10d2 Mon Sep 17 00:00:00 2001 From: admiswalker Date: Sun, 3 Sep 2023 16:38:46 +0900 Subject: [PATCH] wip --- .../src/container/vector/vec_manipulation.md | 63 +++++++++++++------ 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/docs_src/docs/src/container/vector/vec_manipulation.md b/docs_src/docs/src/container/vector/vec_manipulation.md index b486407..139f45f 100644 --- a/docs_src/docs/src/container/vector/vec_manipulation.md +++ b/docs_src/docs/src/container/vector/vec_manipulation.md @@ -27,6 +27,7 @@ namespace sstd{ ``` ## Description +### remove empty objects / 空のオブジェクトの削除 | Function name | Description | | ------------- | ----------- | | rmEmpty () | returns the `std::vector` type which is removed empty objects and .
空のオブジェクトを取り除いた `std::vector` 型を返却します. | @@ -35,19 +36,27 @@ namespace sstd{ | rmEmpty_l_ow() | removes empty objects from left (head) side and overwrites the results to the input argument.
空のオブジェクトを左 (先頭) 側から取り除き,入力を上書きします. | | rmEmpty_r () | returns as the `std::vector` type which is removed empty objects from right (head) side.
空のオブジェクトを右 (末尾) 側から取り除いた `std::vector` 型を返却します. | | rmEmpty_r_ow() | removes empty objects from right (head) side and overwrites the results to the input argument.
空のオブジェクトを右 (末尾) 側から取り除き,入力を上書きします. | -| rmEmpty_ow(arg1, arg2, ...) | removes empty objects and overwrites the results to the input arguments based on the first argment.
第一引数のオブジェクトに従って,空のオブジェクトを取り除き,入力を上書きします. | + +### 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` argment.
第一引数の `std::vector` 型が持つ空の要素に従って,オブジェクトを取り除き,入力を上書きします. | + +### countup empty objects / 空のオブジェクトの数え上げ +| Function name | Description | +| ------------- | ----------- | | cntEmpty | returns the number of empty objects.
空のオブジェクトの数を返却します. | | cntEmpty_l | returns the number of empty objects counted from left (head) side.
左 (先頭) 側から数えた空のオブジェクトの数を返却します. | | cntEmpty_r | returns the number of empty objects counted from right (tail) side.
右 (末尾) 側から数えた空のオブジェクトの数を返却します. | ## Usage +### remove empty objects / 空のオブジェクトの削除 - **main.cpp** ```cpp #mdEx: cpp example (in) #include int main(){ - printf("--- rmEmpty ---\n"); printf("case1:\n"); // case1_1 @@ -84,24 +93,42 @@ int main(){ std::vector v3_2 = {"", "", "2", "3", "", "5", "", ""}; sstd::rmEmpty_r_ow(v3_2); sstd::printn( v3_2 ); +} +``` +- **Execution result** +``` +#mdEx: cpp example (out) +``` - printf("\n"); - //--- - printf("case4: multiple arguments\n"); - - std::vector v4_1 = { "", "", "2a", "3a", "", "5a", "", ""}; - std::vector v4_2 = {"0b", "1b", "2b", "3b", "4b", "5b", "6b", "7b"}; - std::vector 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 / 空ベクトルに基づくオブジェクトの削除 +- **main.cpp** +```cpp +#mdEx: cpp example (in) +#include + +int main(){ + std::vector v1 = { "", "", "2a", "3a", "", "5a", "", ""}; + std::vector v2 = {"0b", "1b", "2b", "3b", "4b", "5b", "6b", "7b"}; + std::vector v3 = {"0c", "1c", "2c", "3c", "4c", "5c", "6c", "7c"}; + sstd::rmEmpty_ow(v1, v2, v3); + sstd::printn( v1 ); + sstd::printn( v2 ); + sstd::printn( v3 ); +} +``` +- **Execution result** +``` +#mdEx: cpp example (out) +``` - std::vector v = {"", "", "2", "3", "", "5", "", ""}; +### countup empty objects / 空のオブジェクトの数え上げ +- **main.cpp** +```cpp +#mdEx: cpp example (in) +#include + +int main(){ + std::vector v = {"", "", "2", "3", "", "5", "", "", ""}; sstd::printn( sstd::cntEmpty (v) ); sstd::printn( sstd::cntEmpty_l(v) );