#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) : vref(alloc(new value(val))) { } vref(ref const & other) : ptr(static_cast*>((concept*)other)) { } operator ref() { return ptr; } T const & val() { return *ptr; } // for use by containers bool operator<(vref const & other) const { return self.ptr < other.ptr; } protected: value * const ptr; }; } }