aboutsummaryrefslogtreecommitdiff
path: root/example_hashmap/new/main.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-09-01 22:00:02 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-09-01 22:00:02 +0300
commite68480f2fc508ce73cad331ce4e8439e07d25702 (patch)
treebfa99b6f20402ba46230771a0d42172fc2169481 /example_hashmap/new/main.c
parent20ce6fa81cd9f55dca3212699d5949f8ebe7d95b (diff)
downloadngc-e68480f2fc508ce73cad331ce4e8439e07d25702.tar.gz
ngc-e68480f2fc508ce73cad331ce4e8439e07d25702.zip
use <> as expansion charactersHEADmaster
+ I kind of like the 'symmetry' of <> being 'self' and <param> being some parameter, but having to type lots of extra <*> is a bit annoying, and might also be an issue for C++. Still, enough functionality for a hashmap example
Diffstat (limited to 'example_hashmap/new/main.c')
-rw-r--r--example_hashmap/new/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/example_hashmap/new/main.c b/example_hashmap/new/main.c
index 4846ab5..db575c6 100644
--- a/example_hashmap/new/main.c
+++ b/example_hashmap/new/main.c
@@ -1,6 +1,9 @@
#include <assert.h>
#include <stdio.h>
+/* provide generic any that matches anything/everything */
+typedef any {}
+
#include "map.h"
#define foreach(name, i, s) \
@@ -9,7 +12,7 @@
/* int wrapper, provides cmp/hash for a generic integer type
* (here a trait like is_integer would be ideal but oh well) */
typedef intw[any I]() {
- typedef I <>;
+ typedef <I> <>;
size_t <>_hash(<> *a)
{