summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge <[email protected]>2020-04-30 17:47:43 +0200
committerTyge <[email protected]>2020-04-30 17:47:43 +0200
commit57bcef67aeb82cb696421817eef8ffaf432b08eb (patch)
treee6dca803c0f8add4d05e8e9be5a507b11099acc1
parentf593e22ddeb516e91044b2452767fec4ea95f167 (diff)
downloadSTC-modified-57bcef67aeb82cb696421817eef8ffaf432b08eb.tar.gz
STC-modified-57bcef67aeb82cb696421817eef8ffaf432b08eb.zip
Added example in cmap.h
-rw-r--r--stc/cmap.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/stc/cmap.h b/stc/cmap.h
index d0b058e2..5c91ec92 100644
--- a/stc/cmap.h
+++ b/stc/cmap.h
@@ -20,6 +20,25 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
+
+/* An example:
+#include <stdio.h>
+#include "stc/cmap.h"
+declare_CMap(ex, int, char);
+
+int main(void) {
+ CMap_ex h = cmap_init;
+ cmap_ex_put(&h, 5, 'a');
+ cmap_ex_put(&h, 8, 'b');
+ CMapEntry_ex* b = cmap_ex_get(h, 10); // = NULL
+ char val = cmap_ex_get(h, 5)->value;
+ cmap_ex_put(&h, 5, 'd');
+ cmap_ex_erase(&h, 8);
+ c_foreach (i, cmap_ex, h)
+ printf("%d: %c\n", i.item->key, i.item->value);
+ cmap_ex_destroy(&h);
+}
+*/
#ifndef CMAP__H__
#define CMAP__H__