From dd35e6f5cf4bda4ae17d7611fbc138fdbdf60c8b Mon Sep 17 00:00:00 2001 From: olpc user Date: Fri, 22 Nov 2019 18:30:17 -0800 Subject: syntax sugar for assigning anonymous to name --- starts/meaning-vm/concept.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'starts/meaning-vm/concept.cpp') 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); +} -- cgit v1.2.3