summaryrefslogtreecommitdiff
path: root/starts/meaning-vm/concept.hpp
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.hpp
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.hpp')
-rw-r--r--starts/meaning-vm/concept.hpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/starts/meaning-vm/concept.hpp b/starts/meaning-vm/concept.hpp
index 7c8fd6d..4d73770 100644
--- a/starts/meaning-vm/concept.hpp
+++ b/starts/meaning-vm/concept.hpp
@@ -14,9 +14,9 @@ struct ref
ref(concept *p) : ptr(p) { if (p == 0) throw std::logic_error("null reference"); }
ref(ref const &) = default;
concept* operator->() { return ptr; }
+ bool operator==(ref const & that) const { return this->ptr == that.ptr; }
- // for use by containers
- bool operator<(ref const & other) const { return ptr < other.ptr; }
+ bool operator<(ref const &) const { throw std::logic_error("ref has redefined syntax sugar: do not use in containers"); }
// for helpers
ref(std::string const &);
@@ -26,8 +26,8 @@ struct ref
value<std::string> & name() const;
operator const char *() const;
- concept operator=(ref other); // helper constructs new concept with this as link
- ref operator[](concept links); // helper sets all links from passed concept
+ ref operator=(ref other); // helper constructs new concept with this as link
+ ref operator[](ref links); // helper sets all links from passed concept
bool isa(ref what) const;
bool isan(ref what) const;
@@ -46,7 +46,7 @@ struct vref
operator ref() { return ptr; }
// for use by containers
- bool operator<(ref const & other) const { return ptr < other.ptr; }
+ //bool operator<(ref const & other) const { return ptr < other.ptr; }
value<T> * ptr;
};
@@ -54,7 +54,7 @@ struct vref
struct concept
{
// a concept is made of concept-typed links to other concepts
- std::multimap<ref,ref> links;
+ std::multimap<concept*,concept*> links;
using array = std::vector<ref>;
ref id();