mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
update.
This commit is contained in:
parent
f162cd308a
commit
901cf714a2
@ -53,7 +53,7 @@ public:
|
|||||||
static type of() {
|
static type of() {
|
||||||
return type_visitor::type<T>();
|
return type_visitor::type<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
static type of(const handle& obj) { return type(vm->_t(obj.ptr())); }
|
static type of(const handle& obj) { return type(vm->_t(obj.ptr())); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -368,6 +368,10 @@ public:
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
capsule(T&& value) : object(create(std::forward<T>(value))) {}
|
capsule(T&& value) : object(create(std::forward<T>(value))) {}
|
||||||
|
|
||||||
|
capsule(void* ptr, void (*destructor)(void*) = nullptr) : object(create(ptr, destructor)) {}
|
||||||
|
|
||||||
|
void* data() const { return self().ptr; }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T& cast() const {
|
T& cast() const {
|
||||||
return *static_cast<T*>(self().ptr);
|
return *static_cast<T*>(self().ptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user