#pragma once #include "common.hpp" #include "memorystore.hpp" #include "ref.hpp" #include "value.hpp" namespace intellect { namespace level0 { template struct vref { vref(value *p) : ptr(p) { } value* operator->() { return ptr; } operator T const &() const { return *ptr; } vref(T const & val) : ptr(alloc(new value(val))) { } vref(ref const & other) : ptr(static_cast*>(other.ptr)) { } operator ref() { return ptr; } // for use by containers bool operator<(vref const & other) const { return self.ptr < other.ptr; } value * const ptr; }; } }