I am sorting through this code right now. Am I missing something or is there no documentation in the reference guide about how to register a converter directly with the registry?
No, but the code I posted does it in the constructor.
Additionally, I was looking at the documentation for implicitly_convertible and I am wondering why I can't just use that in my case.
I want to call:
setObject(ptr<Base> val)
with a NoneType. And I have all my objects (ie. Base) wrapped and set with held types of ref_ptr<>'s. RefPtr's are implicitly convertible to ptr<>'s, so If I register this with boost.python using:
bp::implicitly_convertible< ret_ptr<Base>, ptr<Base> >();
Then shouldn't boost.python be able to convert NoneType --> ref_ptr<Base> --> ptr<Base> ? From the documentation in implicitly_convertible it seems like this should be the case. But I have to admit I have not found the place in the boost.python code where it handles the case of taking a NoneType and automatically converting it into a NULL smart pointer to start with.
Sure -- if your types meet those requirements, then that should work. The rvalue converters I posted are more general. implicitly_convertible just registers an rvalue converter using the same underlying mechanism. From your message, I was under the impression that default-constructing one of your smart pointers would not produce the desired "null" value. Alex