diff options
| author | _Tradam <[email protected]> | 2023-09-08 01:29:47 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-08 01:29:47 +0000 |
| commit | 3c76c7f3d5db3f9586a90d03f8fbb02d79de9acd (patch) | |
| tree | afbe4b540967223911f7c5de36559b82154f02f3 /misc/examples/unordered_set.c | |
| parent | 0841165881871ee01b782129be681209aeed2423 (diff) | |
| parent | 1a72205fe05c2375cfd380dd8381a8460d9ed8d1 (diff) | |
| download | STC-modified-modified.tar.gz STC-modified-modified.zip | |
Diffstat (limited to 'misc/examples/unordered_set.c')
| -rw-r--r-- | misc/examples/unordered_set.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/misc/examples/unordered_set.c b/misc/examples/unordered_set.c deleted file mode 100644 index 61f9cc1f..00000000 --- a/misc/examples/unordered_set.c +++ /dev/null @@ -1,44 +0,0 @@ -// https://iq.opengenus.org/containers-cpp-stl/ -// C program to demonstrate various function of stc cset -#include <stc/cstr.h> -#define i_key_str -#include <stc/cset.h> - -int main() -{ - // declaring set for storing string data-type - cset_str stringSet = {0}; - c_defer( - cset_str_drop(&stringSet) - ){ - // inserting various string, same string will be stored - // once in set - cset_str_emplace(&stringSet, "code"); - cset_str_emplace(&stringSet, "in"); - cset_str_emplace(&stringSet, "C"); - cset_str_emplace(&stringSet, "is"); - cset_str_emplace(&stringSet, "fast"); - - const char* key = "slow"; - - // find returns end iterator if key is not found, - // else it returns iterator to that key - - if (cset_str_find(&stringSet, key).ref == NULL) - printf("\"%s\" not found\n", key); - else - printf("Found \"%s\"\n", key); - - key = "C"; - if (!cset_str_contains(&stringSet, key)) - printf("\"%s\" not found\n", key); - else - printf("Found \"%s\"\n", key); - - // now iterating over whole set and printing its - // content - printf("All elements :\n"); - c_foreach (itr, cset_str, stringSet) - printf("%s\n", cstr_str(itr.ref)); - } -} |
