summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/concept.cpp
diff options
context:
space:
mode:
authorolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-22 18:30:17 -0800
committerolpc user <olpc@xo-5d-f7-86.localdomain>2019-11-22 18:30:17 -0800
commitdd35e6f5cf4bda4ae17d7611fbc138fdbdf60c8b (patch)
tree42b5ae6032a9e9e611d5dad1d83d7f1201cd505c /starts/meaning-vm/concept.cpp
parentc2ed17faa6aa9f8420128d2713c5b557ab333466 (diff)
downloadstandingwithresilience-dd35e6f5cf4bda4ae17d7611fbc138fdbdf60c8b.tar.gz
standingwithresilience-dd35e6f5cf4bda4ae17d7611fbc138fdbdf60c8b.zip
syntax sugar for assigning anonymous to name
Diffstat (limited to 'starts/meaning-vm/concept.cpp')
-rw-r--r--starts/meaning-vm/concept.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/starts/meaning-vm/concept.cpp b/starts/meaning-vm/concept.cpp
index c46b058..c064ed4 100644
--- a/starts/meaning-vm/concept.cpp
+++ b/starts/meaning-vm/concept.cpp
@@ -58,3 +58,17 @@ void concept::unlink(ref type, ref target)
}
throw std::out_of_range("no such concept link to erase");
}
+
+void concept::unlink(ref type)
+{
+ auto ls = links.equal_range(type.ptr);
+ if (ls.first == ls.second) {
+ throw std::out_of_range("no such concept link to erase");
+ }
+ auto mid = ls.first;
+ ++ mid;
+ if (mid != ls.second) {
+ throw std::out_of_range("more than one link of type to erase");
+ }
+ links.erase(ls.first);
+}