#pragma once #include extern "C" { #include "libabacus.h" #include "util.h" } class ref { private: libab_ref val; public: ref(); ref(void* data, void (*free_func)(void*)); ref(const ref& other); ref& operator=(const ref& other); ref& operator=(std::nullptr_t); template bool operator==(T data); operator libab_ref*(); ~ref(); }; template T* get(libab_ref* ref) { return (T*) libab_ref_get(ref); } template bool ref::operator==(T data) { return libab_ref_get(&val) == (void*) data; } template <> bool ref::operator==(std::nullptr_t t);