
Roland Schwarz wrote:
Yes, that's what I though. In other words, your implementation is dynamically checked. (This is consistent with the name 'dynamic_new', BTW).
Yes this is by intent. This way it is possible to prepare for ctors that are not even available at compile time. A user might later decide to (dynamically) hook in a respective class.
Understood.
Please note that my implementation is not very smart and could be improved by someone more knowledgeable than me. Perhaps it is not so hard to add support for automatic type conversion too?
The problem is that need either: 1. A statically available list of overloaded functions, so that compiler can do the overload resolution. 2. Boost.Overload library which can do it using typeid or some other metedata. Such library does not exist, though :-(
Are you sure? Won't the upcoming typeof() library be of help here?
I think it just emulates in-language typeof, and does not do overload resolution.
Well, I mean that unlike your solution, you can query for specific constructor signature. Using plugins as example, even if specific plugin class has additional constructors, it's not possible to call them via generic interface.
I am not sure if I can follow you there. 1) I think querying for specific constructor signature is exactly what I am doing.
Yes, I mean that your solution can query for a specific signature. Mine cannot. That can be considered disadvantage of my solution.
Or do you mean you want to explore an arbitrary class for it's available set of ctors at runtime before calling into them? I cannot see then what is the value of this? This surely would be of interest when trying to bind the classes to a scripting language. But this is not in the scope of my proposal.
I did not consider this too.
Having glanced over your description I think there is some similarity (at least at the creation part). I would be very much interested in your boost::plugin lib! Unfortunately I was not able to find it in the boost or boost-sandbox so far. Can I download it somewhere to experiment with it?
I've just added it to sandbox: boost/plugin and libs/plugin. So far, the example only works for gcc/Linux, but otherwise should be OK. Comments are very appreciated. - Volodya