summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/concept.hpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-24 00:51:53 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-24 00:51:53 -0800
commitb3dea01d1ad6803b96865a846b56494506ccc74e (patch)
treeb6d21894711aff4d0fa1197434a03cacfaf0d594 /starts/meaning-vm/concept.hpp
parentfed2ac694bd028d119581ea05a3376e791aee97d (diff)
downloadstandingwithresilience-b3dea01d1ad6803b96865a846b56494506ccc74e.tar.gz
standingwithresilience-b3dea01d1ad6803b96865a846b56494506ccc74e.zip
changes didn't pan out; next change is big (merging statementevaluable with ref). saving work.
Diffstat (limited to 'starts/meaning-vm/concept.hpp')
-rw-r--r--starts/meaning-vm/concept.hpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/starts/meaning-vm/concept.hpp b/starts/meaning-vm/concept.hpp
index c69ff10..eca2fa5 100644
--- a/starts/meaning-vm/concept.hpp
+++ b/starts/meaning-vm/concept.hpp
@@ -8,6 +8,7 @@
template <typename T> struct vref;
struct concept;
template <typename T> struct value;
+class statementevaluable;
struct ref
{
@@ -24,11 +25,11 @@ struct ref
ref(char const * str) : ref(std::string(str)) { }
ref(bool b) : ref(b ? "true" : "false") { }
ref() : ref("nothing") { }
- value<std::string> & name() const; // this is a reference so that its char pointer lasts
+ vref<std::string> name() const;
operator const char *() const;
// helper linking syntax sugar
- ref operator=(ref that);
+ statementevaluable operator=(ref that);
ref operator<<(ref target);
ref operator[](ref links);
@@ -75,12 +76,17 @@ struct concept
};
template <typename T>
-struct value : public concept, public T
+struct value : public concept
{
- value(T const & val) : T(val) { }
+ value(T const & val) : data(val) { }
value(value<T> const & val) = default;
static value<T>& of(ref c)
{
return *static_cast<value<T>*>(c.ptr);
}
+
+ operator T&() { return data; }
+ operator T const &() const { return data; }
+
+ T data;
};