diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-21 17:31:16 -0500 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2019-11-21 17:31:16 -0500 |
commit | 55f586437b52bda32793a376f8ea5df9fb1b89e2 (patch) | |
tree | d1efc540c35a121548478add010dd5363f6fa7b6 /starts/meaning-vm/helpers.cpp | |
parent | 6e81ffa9f5baabe8d4b16fa927ce423fbe26771e (diff) | |
download | standingwithresilience-55f586437b52bda32793a376f8ea5df9fb1b89e2.tar.gz standingwithresilience-55f586437b52bda32793a376f8ea5df9fb1b89e2.zip |
helpers
Diffstat (limited to 'starts/meaning-vm/helpers.cpp')
-rw-r--r-- | starts/meaning-vm/helpers.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/starts/meaning-vm/helpers.cpp b/starts/meaning-vm/helpers.cpp index e4a7689..fb17f6c 100644 --- a/starts/meaning-vm/helpers.cpp +++ b/starts/meaning-vm/helpers.cpp @@ -9,7 +9,7 @@ concept namesByConcept; std::unordered_map<value<std::string>,concept,std::hash<std::string>> conceptsByName; -ref::ref(std::string s) +ref::ref(std::string const & s) { try { ptr = &conceptsByName.at(value<std::string>(s)); @@ -18,11 +18,15 @@ ref::ref(std::string s) ref con = &insertion.first->second; ref nam = const_cast<concept *>((concept const *)&insertion.first->first); namesByConcept.link(con, nam); - ptr = con; + ptr = con.ptr; } } -ref::operator std::string() +value<std::string> & ref::name() const { return value<std::string>::of(namesByConcept.get(*this)); } + +ref::operator const char *() const { + return name().c_str(); +} |