diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2020-01-10 18:05:43 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2020-01-10 18:05:43 -0800 |
commit | 3223a360d0e70f75497aecf8c033a4f987335b5b (patch) | |
tree | c34e5ed5d7aa83513447644b4774c0449336657f /intellect-framework-from-internet/starts/meaning-vm/level-1/baseref.hpp | |
parent | 26c980d302adce8e3d802cb8db8ab1c69d58ce1a (diff) | |
download | standingwithresilience-3223a360d0e70f75497aecf8c033a4f987335b5b.tar.gz standingwithresilience-3223a360d0e70f75497aecf8c033a4f987335b5b.zip |
I'm confused and am handling multiple unexpected systems issues
Diffstat (limited to 'intellect-framework-from-internet/starts/meaning-vm/level-1/baseref.hpp')
-rw-r--r-- | intellect-framework-from-internet/starts/meaning-vm/level-1/baseref.hpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/intellect-framework-from-internet/starts/meaning-vm/level-1/baseref.hpp b/intellect-framework-from-internet/starts/meaning-vm/level-1/baseref.hpp deleted file mode 100644 index ac6ff9c..0000000 --- a/intellect-framework-from-internet/starts/meaning-vm/level-1/baseref.hpp +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include "common.hpp" -#include "funcs.hpp" - -#include "../level-0/ref.hpp" - -#include <functional> - -namespace intellect { -namespace level1 { - -template <typename ref> -struct baseref : public level0::baseref<ref> -{ - baseref(concept * p) : level0::baseref<ref>(p) { } - baseref(level0::ref const & other) : baseref(other.ptr()) { } - baseref(std::string const & name, concept* allocator = nullptr) : baseref(getnamed(name, allocator)) { } - baseref(const char *name, concept* allocator = nullptr) : baseref(std::string(name), allocator) { } - baseref(bool b) : baseref(b ? "true" : "false") { } - baseref() : baseref("nothing") { } - - bool isa(ref group) const { return level1::isa(self, group); } - bool isan(ref group) const { return isa(group); } - - std::string name() const { return getname(self); } - explicit operator char const *() const { return getname(self)->data.c_str(); } - - ref operator-(ref other) const { return hyphenate(self, other); } - ref operator[](ref subref) const { return self.get(subref); } - - template <typename T> - void vset(ref const & type, T const & v) { self.set(type, level1::alloc(level0::concepts::allocations(), v)); } - - template <typename... Ref> - std::function<ref(Ref...)> & fun() { return self.template val<std::function<ref(Ref...)>>(); } - template <typename... Ref> - void fun(std::function<ref(Ref...)> const & f) { self.val(f); } - template <typename... Ref> - void fun(std::function<void(Ref...)> const & f) { self.val(voidtoret(f)); } - template <typename... Ref> - void fget(ref const & type) { return self.template vget<std::function<ref(Ref...)>>(type); } - template <typename... Ref> - void fset(ref const & type, std::function<ref(Ref...)> f) { self.vset(type, f); } - template <typename... Ref> - void fset(ref const & type, std::function<void(Ref...)> f) { fset(type, voidtoret(f)); } - - template <typename... Ref> - ref operator()(Ref... args) { return self.template fun<Ref...>()(args...); } - - std::string dump(ref set) { return level1::dump(self, set); }; - -private: - template <typename... Refs> - std::function<ref(Refs...)> voidtoret(std::function<void(Refs...)> f) - { - return [f](Refs... args) -> ref - { - std::initializer_list<ref const *>({&args...}); - f(args...); - return "nothing"; - }; - } -}; - -} -} |