11#ifndef ARK_VM_VALUE_USERTYPE_HPP 
   12#define ARK_VM_VALUE_USERTYPE_HPP 
   26            static inline uint16_t 
id = 0;
 
 
   57            std::function<void(
void*)> 
deleter = 
nullptr;
 
 
   85        [[nodiscard]] 
void* 
data() const noexcept
 
 
  106        template <
typename T>
 
  107        [[nodiscard]] 
bool is() const noexcept
 
 
  118        template <
typename T>
 
  121            return *
static_cast<T*
>(
m_data);
 
 
  130        template <
typename T>
 
  131        const T& 
as() const noexcept
 
  133            return *
static_cast<T*
>(
m_data);
 
 
 
  149struct std::hash<Ark::UserType>
 
  153        return std::hash<void*> {}(s.m_data);
 
 
 
A class to be use C++ objects in ArkScript.
 
UserType(T *data=nullptr, ControlFuncs *block=nullptr) noexcept
Construct a new User Type object.
 
const T & as() const noexcept
Return the underlying object as a given type.
 
friend ARK_API std::ostream & operator<<(std::ostream &os, const UserType &A) noexcept
 
T & as() noexcept
Return the underlying object as a given type.
 
void * data() const noexcept
Get the pointer to the object.
 
bool is() const noexcept
Check if the object held is of a given type.
 
void del() const
Free memory through the control functions block.
 
friend ARK_API bool operator==(const UserType &A, const UserType &B) noexcept
 
friend ARK_API bool operator<(const UserType &A, const UserType &B) noexcept
 
A structure holding a bunch of pointers to different useful functions related to this usertype.
 
std::function< void(void *)> deleter
 
std::function< std::ostream &(std::ostream &, const UserType &)> ostream_func
 
static const uint16_t value
 
std::size_t operator()(const Ark::UserType &s) const noexcept