#pragma once #include "critter-script.hpp" #include "compat/assert.hpp" namespace floormat { template script_wrapper::script_wrapper(T* ptr): ptr{ptr} { fm_assert(ptr); } template script_wrapper::~script_wrapper() noexcept { ptr->delete_self(); #ifndef FM_NO_DEBUG ptr = nullptr; #endif } template const T& script_wrapper::operator*() const noexcept { return *ptr; } template T& script_wrapper::operator*() noexcept { return *ptr; } template const T* script_wrapper::operator->() const noexcept { return ptr; } template T* script_wrapper::operator->() noexcept { return ptr; } } // namespace floormat