From 618b5704e6f85cfe1b6e5c9c9373abe76a8bb628 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sat, 6 Aug 2022 17:48:06 +0200 Subject: c_apply() deprecated: replaced with c_forarray() macro. Updated and improved README.md docs. --- docs/carc_api.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'docs/carc_api.md') diff --git a/docs/carc_api.md b/docs/carc_api.md index 534e3da3..2604e13a 100644 --- a/docs/carc_api.md +++ b/docs/carc_api.md @@ -100,25 +100,26 @@ int main() // POPULATE the stack with shared pointers to Map: Map *map; map = Stack_push(&stack, Arc_make(Map_init()))->get; - c_apply(v, Map_emplace(map, c_pair(v)), Map_raw, { + c_forarray (Map_raw, v, { {"Joey", 1990}, {"Mary", 1995}, - {"Joanna", 1992} - }); + {"Joanna", 1992}, + }) Map_emplace(map, v->first, v->second); + map = Stack_push(&stack, Arc_make(Map_init()))->get; - c_apply(v, Map_emplace(map, c_pair(v)), Map_raw, { + c_forarray (Map_raw, v, { {"Rosanna", 2001}, {"Brad", 1999}, {"Jack", 1980} - }); + }) Map_emplace(map, v->first, v->second); // POPULATE the list: map = List_push_back(&list, Arc_make(Map_init()))->get; - c_apply(v, Map_emplace(map, c_pair(v)), Map_raw, { + c_forarray (Map_raw, v, { {"Steve", 1979}, {"Rick", 1974}, {"Tracy", 2003} - }); + }) Map_emplace(map, v->first, v->second); // Share two Maps from the stack with the list by cloning(=sharing) the carc: List_push_back(&list, Arc_clone(stack.data[0])); -- cgit v1.2.3