
While writing code for Init, my new static initialization library, I discovered that I need to be able to dynamically bind a series of parameters (the types are not known by my code - they will be passed through a template function) and store the functor, so as to defer the actual function call (a constructor in this case, so the return type is known). I haven't used Boost.Bind all that often, but I don't think it supports dynamic polymorphism on the return type. A template is not an option in this case, because I can't use argument deduction on class types, and you can't call functions from global scope. If anyone knows a useable substitute that I can use to avoid having to rewrite the binding system, that would be exceptional! Sean Hunt

Mathias Gaunard wrote:
Sean Hunt wrote:
dynamic polymorphism on the return type.
What is that supposed to mean? Are you talking about covariant return types?
No, I picked a bad name. I meant that the return type is known, so that I might store a bound_func<int>, which is some nullary functor which returns an int. Sean Hunt

AMDG Sean Hunt wrote:
Mathias Gaunard wrote:
Sean Hunt wrote:
dynamic polymorphism on the return type.
What is that supposed to mean? Are you talking about covariant return types?
No, I picked a bad name. I meant that the return type is known, so that I might store a bound_func<int>, which is some nullary functor which returns an int.
It sounds like you want boost::function<int()> In Christ, Steven Watanabe
participants (3)
-
Mathias Gaunard
-
Sean Hunt
-
Steven Watanabe