You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importexampleb=example.B()
print_from_b=example.print(b) # This should print "I am B" due to implicit conversionc=example.C()
print_from_c=example.print(c) # This should print "I am C" due to implicit conversion
The error traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in<module>
TypeError: printA(): incompatible functionarguments. The following argument types are supported:
1. (arg0: example.A) -> None
Invoked with: <example.B object at 0x75f99e0c3130>
Reproducible example code
No response
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered:
I'm trying to do a similar thing with nanobind right now. I think one would need to actually create their own template<typename Concrete> implicit_convertible_with_concept(py::class_<A>&cl) which would take the exposing py::class_ object as an argument and defs the constructor:
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
2.13.1
Problem description
Could we make implicitly_convertible explicitly instantiate templated constructors?
Consider this type erasure pattern (remark the template constructor of A for implicit conversion).
The python binding:
I would expect the python binding to behave like:
The error traceback:
Reproducible example code
No response
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: