summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-05-22 15:20:32 +0200
committerTyge Løvset <[email protected]>2021-05-22 15:20:32 +0200
commit7472580ee0159d7164bf2a219c292cd060b904a2 (patch)
tree51c3ef11078dbf09ad78d7af07d24c3e4eed375f /examples
parent24f6e33a161b70f549d2c436dd1fc2b4c705273a (diff)
downloadSTC-modified-7472580ee0159d7164bf2a219c292cd060b904a2.tar.gz
STC-modified-7472580ee0159d7164bf2a219c292cd060b904a2.zip
Added *_value_toraw() methods to base containers.
Diffstat (limited to 'examples')
-rw-r--r--examples/csmap_erase.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/csmap_erase.c b/examples/csmap_erase.c
index eb3700b1..1276bd7b 100644
--- a/examples/csmap_erase.c
+++ b/examples/csmap_erase.c
@@ -1,5 +1,5 @@
// map_erase.c
-// https://docs.microsoft.com/en-us/cpp/standard-library/map-class?view=msvc-160#emplace
+// https://docs.microsoft.com/en-us/cpp/standard-library/map-class?view=msvc-160#example-16
#include <stc/csmap.h>
#include <stc/cstr.h>
#include <stdio.h>
@@ -27,13 +27,12 @@ int main()
puts("Starting data of map m1 is:");
printmap(m1);
// The 1st member function removes an element at a given position
- csmap_my_iter_t it = csmap_my_begin(&m1); csmap_my_next(&it);
- csmap_my_erase_at(&m1, it);
+ csmap_my_erase_at(&m1, csmap_my_fwd(csmap_my_begin(&m1), 1));
puts("After the 2nd element is deleted, the map m1 is:");
printmap(m1);
}
- c_with (csmap_my m2 = csmap_my_init(), csmap_my_del(&m2))
+ c_withvar (csmap_my, m2)
{
// Fill in some data to test with, one at a time, using emplace
c_emplace(csmap_my, m2, {
@@ -55,7 +54,7 @@ int main()
printmap(m2);
}
- c_with (csmap_my m3 = csmap_my_init(), csmap_my_del(&m3))
+ c_withvar (csmap_my, m3)
{
// Fill in some data to test with, one at a time, using emplace
csmap_my_emplace(&m3, 1, "red");
@@ -75,5 +74,4 @@ int main()
puts("After the element with a key of 2 is deleted, the map m3 is:");
printmap(m3);
}
-
} \ No newline at end of file