diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-23 09:11:28 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-23 09:11:28 -0800 |
commit | fed2ac694bd028d119581ea05a3376e791aee97d (patch) | |
tree | 726785b677c3109a16a9b0b1b27ade16b2cfea51 /starts/meaning-vm/helpers.hpp | |
parent | c0fdff872ca2c48939bacfefce020878ef92b44c (diff) | |
download | standingwithresilience-fed2ac694bd028d119581ea05a3376e791aee97d.tar.gz standingwithresilience-fed2ac694bd028d119581ea05a3376e791aee97d.zip |
more syntax sugar, building meaning
Diffstat (limited to 'starts/meaning-vm/helpers.hpp')
-rw-r--r-- | starts/meaning-vm/helpers.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/starts/meaning-vm/helpers.hpp b/starts/meaning-vm/helpers.hpp index eca2479..8c7e307 100644 --- a/starts/meaning-vm/helpers.hpp +++ b/starts/meaning-vm/helpers.hpp @@ -48,6 +48,22 @@ void __helper_init_ref_names(std::string names, T &... refrefs) ref __VA_ARGS__; \ __helper_init_ref_names(#__VA_ARGS__, __VA_ARGS__) +template <typename... T> +void lnks(T ... passedrefs) +{ + std::initializer_list<ref> refs = { passedrefs... }; + declrefs(link, type, is); + for (ref r : refs) { + if (!r->linked(is, link-type)) { + r->link(is, link-type); + } + } +} + +#define decllnks(...) \ + declrefs(__VA_ARGS__); \ + lnks(__VA_ARGS__) + ref operator,(ref a, ref b); ref operator-(ref a, ref b); |