diff options
| author | Tyge Løvset <[email protected]> | 2022-08-11 17:58:15 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-08-11 17:58:15 +0200 |
| commit | 5cf6b762012168be51b32a1a85ab2bc33504f020 (patch) | |
| tree | 9fd59787a0d33d23196b77cecbd31ef5d44e103a /docs/cbox_api.md | |
| parent | 9831e8d6ee6772a4f9899cf9e3d36e3de47bbaf5 (diff) | |
| download | STC-modified-5cf6b762012168be51b32a1a85ab2bc33504f020.tar.gz STC-modified-5cf6b762012168be51b32a1a85ab2bc33504f020.zip | |
Fixed issue with cbox / carc. Minor update some examples.
Diffstat (limited to 'docs/cbox_api.md')
| -rw-r--r-- | docs/cbox_api.md | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/docs/cbox_api.md b/docs/cbox_api.md index 1119d930..9801ad92 100644 --- a/docs/cbox_api.md +++ b/docs/cbox_api.md @@ -68,7 +68,7 @@ void int_drop(int* x) { #define i_type IBox #define i_val int #define i_valdrop int_drop // optional func, just to display elements destroyed -#define i_valclone(x) x // must specify because i_valdrop was defined. +#define i_valclone(x) x // must specified when i_valdrop is defined. #include <stc/cbox.h> #define i_type ISet @@ -84,10 +84,8 @@ int main() c_auto (IVec, vec) // declare and init vec, call drop at scope exit c_auto (ISet, set) // similar { - c_forarray (IBox, v, { - IBox_make(2021), IBox_make(2012), - IBox_make(2022), IBox_make(2015), - }) IVec_push(&vec, *v); + c_forarray (int, v, {2021, 2012, 2022, 2015}) + IVec_emplace(&vec, *v); // same as: IVec_push(&vec, IBox_from(*v)); printf("vec:"); c_foreach (i, IVec, vec) |
