summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/level-0
diff options
context:
space:
mode:
Diffstat (limited to 'starts/meaning-vm/level-0')
-rw-r--r--starts/meaning-vm/level-0/memorystore.cpp5
-rw-r--r--starts/meaning-vm/level-0/memorystore.hpp1
-rw-r--r--starts/meaning-vm/level-0/vref.hpp3
3 files changed, 8 insertions, 1 deletions
diff --git a/starts/meaning-vm/level-0/memorystore.cpp b/starts/meaning-vm/level-0/memorystore.cpp
index 6cf71df..0a4f0cc 100644
--- a/starts/meaning-vm/level-0/memorystore.cpp
+++ b/starts/meaning-vm/level-0/memorystore.cpp
@@ -55,5 +55,10 @@ void dealloc(ref r) {
throw no_such_concept(r);
}
+std::size_t allocated()
+{
+ return concepts().size();
+}
+
}
}
diff --git a/starts/meaning-vm/level-0/memorystore.hpp b/starts/meaning-vm/level-0/memorystore.hpp
index 4e0a2bd..a86ccea 100644
--- a/starts/meaning-vm/level-0/memorystore.hpp
+++ b/starts/meaning-vm/level-0/memorystore.hpp
@@ -8,6 +8,7 @@ namespace level0 {
ref alloc(concept * moved = 0);
void dealloc(ref);
+std::size_t allocated();
}
}
diff --git a/starts/meaning-vm/level-0/vref.hpp b/starts/meaning-vm/level-0/vref.hpp
index 7fe2045..cffc8f5 100644
--- a/starts/meaning-vm/level-0/vref.hpp
+++ b/starts/meaning-vm/level-0/vref.hpp
@@ -15,10 +15,11 @@ struct vref
value<T>* operator->() { return ptr; }
operator T const &() const { return *ptr; }
- vref(T const & val) : ptr(alloc(new value<T>(val))) { }
+ vref(T const & val) : vref(alloc(new value<T>(val))) { }
vref(ref const & other) : ptr(static_cast<value<T>*>(other.ptr)) { }
operator ref() { return ptr; }
+ T const & val() { return *ptr; }
// for use by containers
bool operator<(vref<T> const & other) const { return self.ptr < other.ptr; }