fix has_shared_from_this any_cast

This commit is contained in:
Joachim Schoeberl 2024-01-14 04:33:55 +01:00
parent 2d2503bbbb
commit 1ff8c97b1d

View File

@ -73,8 +73,8 @@ namespace ngcore {
}; };
#ifdef NETGEN_PYTHON #ifdef NETGEN_PYTHON
info.anyToPyCaster = [](const std::any &a) { info.anyToPyCaster = [](const std::any &a) {
if constexpr(has_shared_from_this<T>::value) { if constexpr(has_shared_from_this2<T>::value) {
std::shared_ptr<T> val = std::any_cast<std::shared_ptr<T>>(&a); std::shared_ptr<T> val = std::any_cast<std::shared_ptr<T>>(a);
return pybind11::cast(val); return pybind11::cast(val);
} else { } else {
const T* val = std::any_cast<T>(&a); const T* val = std::any_cast<T>(&a);