summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-0/concept.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'starts/meaning-vm/level-0/concept.hpp')
-rw-r--r--starts/meaning-vm/level-0/concept.hpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/starts/meaning-vm/level-0/concept.hpp b/starts/meaning-vm/level-0/concept.hpp
index 3bd1609..d57ccfc 100644
--- a/starts/meaning-vm/level-0/concept.hpp
+++ b/starts/meaning-vm/level-0/concept.hpp
@@ -2,6 +2,7 @@
#include "common.hpp"
+#include <any>
#include <map>
#include <vector>
@@ -12,6 +13,9 @@ struct concept
{
// a concept is made of concept-typed links to other concepts
std::multimap<concept*,concept*> links;
+ // and optional associated arbitrary data
+ std::any data;
+
using array = std::vector<concept*>;
concept* id();
@@ -30,10 +34,10 @@ struct concept
void set(concept* type, concept* target);
template <typename T>
- value<T>* vget(concept* type) const { return static_cast<value<T>*>(get(type)); }
+ T & vget(concept* type) const { return get(type)->val<T>(); }
template <typename T>
- value<T>* val() { return this; }
+ T & val() { return std::any_cast<T&>(data); }
};
}