summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/memorystore.cpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-22 17:55:18 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-22 17:55:18 -0800
commitc2ed17faa6aa9f8420128d2713c5b557ab333466 (patch)
treea6d4755f797896f641891565e9d2965c97513b7c /starts/meaning-vm/memorystore.cpp
parentc699a8913c5c1e53e0b701109dabe2b8fc70b644 (diff)
downloadstandingwithresilience-c2ed17faa6aa9f8420128d2713c5b557ab333466.tar.gz
standingwithresilience-c2ed17faa6aa9f8420128d2713c5b557ab333466.zip
use refs for temporaries, which means pulling them out of containers
Diffstat (limited to 'starts/meaning-vm/memorystore.cpp')
-rw-r--r--starts/meaning-vm/memorystore.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/starts/meaning-vm/memorystore.cpp b/starts/meaning-vm/memorystore.cpp
index 0d636ee..4178a4b 100644
--- a/starts/meaning-vm/memorystore.cpp
+++ b/starts/meaning-vm/memorystore.cpp
@@ -5,24 +5,24 @@
using namespace std;
-std::vector<ref> concepts;
+std::vector<concept*> concepts;
ref alloc(concept * moved) {
ref r = moved ? moved : new concept();
- concepts.push_back(r);
+ concepts.push_back(r.ptr);
return r;
}
bool referenced(ref r) {
- for (auto & r2 : concepts) {
+ for (ref r2 : concepts) {
if (r2 == r) {
continue;
}
for (auto & l : r2->links) {
- if (l.first == r) {
+ if (ref(l.first) == r) {
return true;
}
- if (l.second == r) {
+ if (ref(l.second) == r) {
return true;
}
}
@@ -39,9 +39,9 @@ void dealloc(ref r) {
it != concepts.end();
++ it)
{
- if (*it == r) {
+ if (ref(*it) == r) {
concepts.erase(it);
- delete r;
+ delete r.ptr;
return;
}
}