From cd03e291664cb102bde61d86a15f0add11809766 Mon Sep 17 00:00:00 2001 From: olpc user Date: Sun, 24 Nov 2019 19:23:37 -0800 Subject: messy but works. rushing to get this done with may have been a poor investment. --- starts/meaning-vm/level-1/vref.hpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 starts/meaning-vm/level-1/vref.hpp (limited to 'starts/meaning-vm/level-1/vref.hpp') diff --git a/starts/meaning-vm/level-1/vref.hpp b/starts/meaning-vm/level-1/vref.hpp new file mode 100644 index 0000000..fb7ba5d --- /dev/null +++ b/starts/meaning-vm/level-1/vref.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include "../level-0/vref.hpp" +#include "ref.hpp" + +#include + +namespace intellect { +namespace level1 { + +template +struct vref : public level0::vref +{ + vref(level0::vref other) : level0::vref((level0::concept*)other.ref) { } + vref(level0::value *p) : level0::vref(p) { } + vref(ref const & other) : level0::vref(other) { } + vref(T const & val) + : level0::vref(val) + { + std::stringstream ss; + ss << "v:" << val; + ref(self).set(ref("name"), (level0::ref)level0::vref(ss.str())); + } + + using level0::vref::operator->; + using level0::vref::operator T const &; + + vref name() + { + return ref(self).name(); + } + + operator ref() { return level0::ref(level0::vref::ptr); } +}; + + +} +} -- cgit v1.2.3