summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/concept.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/concept.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/concept.cpp')
-rw-r--r--starts/meaning-vm/concept.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/starts/meaning-vm/concept.cpp b/starts/meaning-vm/concept.cpp
index 825ab5a..c46b058 100644
--- a/starts/meaning-vm/concept.cpp
+++ b/starts/meaning-vm/concept.cpp
@@ -7,7 +7,7 @@ ref concept::id()
bool concept::linked(ref type)
{
- return links.count(type) > 0;
+ return links.count(type.ptr) > 0;
}
bool concept::linked(ref type, ref target)
@@ -22,7 +22,7 @@ bool concept::linked(ref type, ref target)
ref concept::get(ref type)
{
- auto result = links.equal_range(type);
+ auto result = links.equal_range(type.ptr);
if (result.first == result.second) {
throw std::out_of_range("no such concept link to get: " + type.name());
}
@@ -33,7 +33,7 @@ concept::array concept::getAll(ref type)
{
array ret;
for (
- auto range = links.equal_range(type);
+ auto range = links.equal_range(type.ptr);
range.first != range.second;
++ range.first
) {
@@ -44,14 +44,14 @@ concept::array concept::getAll(ref type)
void concept::link(ref type, ref target)
{
- links.insert({type, target});
+ links.insert({type.ptr, target.ptr});
}
void concept::unlink(ref type, ref target)
{
- auto ls = links.equal_range(type);
+ auto ls = links.equal_range(type.ptr);
for (auto l = ls.first; l != ls.second; ++ l) {
- if (l->second == target) {
+ if (l->second == target.ptr) {
links.erase(l);
return;
}