diff options
| author | Tyge Løvset <[email protected]> | 2021-09-23 20:55:07 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-09-23 20:55:07 +0200 |
| commit | 2686887e9091b3d56365b8ddc15db67324ee6727 (patch) | |
| tree | 48e634d4eaebb7c67e3816f4110a150343f9c366 /docs/csmap_api.md | |
| parent | 4ab5b3f6f5c841ab8c2202e838979a0d6df91530 (diff) | |
| download | STC-modified-2686887e9091b3d56365b8ddc15db67324ee6727.tar.gz STC-modified-2686887e9091b3d56365b8ddc15db67324ee6727.zip | |
Cleanup: Replaced c_emplace() macro with more general c_apply()/c_apply_pair() macros, and removed c_var() macro.
Removed CX_emplace_items() member functions in containers used by c_emplace().
Diffstat (limited to 'docs/csmap_api.md')
| -rw-r--r-- | docs/csmap_api.md | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/csmap_api.md b/docs/csmap_api.md index 1a7ed78c..c6adcea9 100644 --- a/docs/csmap_api.md +++ b/docs/csmap_api.md @@ -58,7 +58,6 @@ csmap_X_result_t csmap_X_put(csmap_X* self, i_key key, i_val mapped); csmap_X_result_t csmap_X_emplace(csmap_X* self, i_keyraw rkey, i_valraw rmapped); // no change if rkey in map csmap_X_result_t csmap_X_emplace_or_assign(csmap_X* self, i_keyraw rkey, i_valraw rmapped); // always update rmapped -void csmap_X_emplace_items(csmap_X* self, const csmap_X_rawvalue_t arr[], size_t n); size_t csmap_X_erase(csmap_X* self, i_keyraw rkey); csmap_X_iter_t csmap_X_erase_at(csmap_X* self, csmap_X_iter_t it); // returns iter after it @@ -96,7 +95,8 @@ csmap_X_rawvalue_t csmap_X_value_toraw(csmap_X_value_t* pval); int main() { // Create an unordered_map of three strings (maps to string) - c_var (csmap_str, colors, { + csmap_str, colors = csmap_str_init(); + c_apply(csmap_str, emplace, &colors, { {"RED", "#FF0000"}, {"GREEN", "#00FF00"}, {"BLUE", "#0000FF"} @@ -140,7 +140,8 @@ This example uses a csmap with cstr as mapped value. int main() { uint32_t col = 0xcc7744ff; - c_var (csmap_id, idnames, { + csmap_id idnames = csmap_id_init(); + c_apply(csmap_id, push_back, &idnames, { {100, "Red"}, {110, "Blue"}, }); |
