diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-24 19:23:37 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-24 19:23:37 -0800 |
commit | cd03e291664cb102bde61d86a15f0add11809766 (patch) | |
tree | 9afb4bc872236b95debd5e20daf00797c563c666 /starts/meaning-vm/level-1/vref.hpp | |
parent | dbbed1e4e1d4b3f268c71236c89f1d673fa0c165 (diff) | |
download | standingwithresilience-cd03e291664cb102bde61d86a15f0add11809766.tar.gz standingwithresilience-cd03e291664cb102bde61d86a15f0add11809766.zip |
messy but works. rushing to get this done with may have been a poor investment.
Diffstat (limited to 'starts/meaning-vm/level-1/vref.hpp')
-rw-r--r-- | starts/meaning-vm/level-1/vref.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
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 <sstream> + +namespace intellect { +namespace level1 { + +template <typename T> +struct vref : public level0::vref<T> +{ + vref(level0::vref<T> other) : level0::vref<T>((level0::concept*)other.ref) { } + vref(level0::value<T> *p) : level0::vref<T>(p) { } + vref(ref const & other) : level0::vref<T>(other) { } + vref(T const & val) + : level0::vref<T>(val) + { + std::stringstream ss; + ss << "v:" << val; + ref(self).set(ref("name"), (level0::ref)level0::vref<std::string>(ss.str())); + } + + using level0::vref<T>::operator->; + using level0::vref<T>::operator T const &; + + vref<std::string> name() + { + return ref(self).name(); + } + + operator ref() { return level0::ref(level0::vref<T>::ptr); } +}; + + +} +} |