diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-09-01 22:00:02 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-09-01 22:00:02 +0300 |
commit | e68480f2fc508ce73cad331ce4e8439e07d25702 (patch) | |
tree | bfa99b6f20402ba46230771a0d42172fc2169481 /example_hashmap/new/main.c | |
parent | 20ce6fa81cd9f55dca3212699d5949f8ebe7d95b (diff) | |
download | ngc-master.tar.gz ngc-master.zip |
+ 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.c | 5 |
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) { |