#pragma once #include "common.hpp" #include "funcs.hpp" #include "../level-1/baseref.hpp" #include namespace intellect { namespace level2 { template struct baseref : public level1::baseref { using level1::template baseref::baseref; // thread-local context static ref & context() { return level2::context(); } template ref operator()(ref first, Refs... rest) { return level2::dohabit(self, {first, rest...}); } ref operator()(std::initializer_list> pairs) { return level2::dohabit(self, pairs); } ref operator()() { return level2::dohabit(self); } template ref act(ref habit, Refs... rest) { return level2::dohabit(habit, {self, rest...}); } void replace(ref other) { *self.ptr() = *other.ptr(); } }; } }