This commit is contained in:
blueloveTH 2024-05-13 16:53:03 +08:00
parent 7bfe8d4bbf
commit 4e8b0ea9d5
2 changed files with 2 additions and 3 deletions

View File

@ -103,7 +103,6 @@ struct Type {
bool operator==(Type other) const { return this->index == other.index; }
bool operator!=(Type other) const { return this->index != other.index; }
constexpr operator int() const { return index; }
constexpr operator bool() const { return index != 0; }
};
#define PK_LAMBDA(x) ([](VM* vm, ArgsView args) { return x; })

View File

@ -494,7 +494,7 @@ PyVar py_var(VM* vm, __T&& value){
return from_void_p(vm, (void*)value);
}else{
constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
if constexpr(const_type){
if constexpr((bool)const_type){
if constexpr(is_sso_v<T>) return PyVar(const_type, value);
else return vm->heap.gcnew<T>(const_type, std::forward<__T>(value));
}
@ -550,7 +550,7 @@ __T _py_cast__internal(VM* vm, PyVar obj) {
return to_void_p<T>(vm, obj);
}else{
constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
if constexpr(const_type){
if constexpr((bool)const_type){
if constexpr(with_check){
if constexpr(std::is_same_v<T, Exception>){
// Exception is `subclass_enabled`