I am trying to write the piece of code which will do the following: let's assume we have a call of custom bind function
auto bind_obj = bind(some_func, _1)
and after we have
auto res = bind_obj(42, "test")
where the function some_func:
int some_func(int val, string test)
How can it possible to match placeholders with arguments provided in actual function call, i.e. bind_obj(...)??
In other words, is it possible to iterate over std::tuple (arguments and placeholders here) and variadic pack (function arguments) to:
- deduce the return type of function some_func;
- make correct std::tuple to further use it in some_func() call ?
I am trying to do this via pure C++, not boost nor std::functional. I think, my main problem is that i don't understand how to build tuple at runtime with arguments (where all the placeholders replaced correctly) and to deduce return type.
I saw _Mu template structure in STL "functional.h" but it looks too complex and overloaded.
Aucun commentaire:
Enregistrer un commentaire