xo-interpreter: implement variable lookup
This commit is contained in:
parent
5c032834c6
commit
e5a72bce36
1 changed files with 4 additions and 0 deletions
|
|
@ -39,6 +39,10 @@ namespace xo {
|
||||||
template <typename S>
|
template <typename S>
|
||||||
gc_ptr(const gc_ptr<S> & x) : ptr_{x.ptr()} {}
|
gc_ptr(const gc_ptr<S> & x) : ptr_{x.ptr()} {}
|
||||||
|
|
||||||
|
/** runtime downcast. shorthand for dynamic_cast<T*> **/
|
||||||
|
template <typename S>
|
||||||
|
static gc_ptr<T> from(const gc_ptr<S> & x) { return gc_ptr<T>{dynamic_cast<T*>(x.ptr())}; }
|
||||||
|
|
||||||
/** convenience for static asserts **/
|
/** convenience for static asserts **/
|
||||||
static constexpr bool is_gc_ptr = true;
|
static constexpr bool is_gc_ptr = true;
|
||||||
/** see also: xo/refcnt/Refcounted.hpp **/
|
/** see also: xo/refcnt/Refcounted.hpp **/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue