|
Boost Users : |
Subject: Re: [Boost-users] framework for invoking func-ptrs with different argument numbers
From: TONGARI J (tongari95_at_[hidden])
Date: 2013-08-16 22:31:02
2013/8/17 firespot <firespot71_at_[hidden]>
> Hi,
>
> Consider the following task: Given a
> -) pointer to a function, and
> -) an iterator range with elements of type void *,
> the function-ptr shall be called with all the elements in the range as
> arguments.
>
> So conceptionally something like this:
>
> template <typename Func, typename Iter>
> void make_call(Func, Iter begin, Iter end)
> {
> int n = std::distance(begin, end);
> (*Func) (*(begin), *(begin + 1), *(begin + 2), ..., *(begin + n - 1))
> }
>
> The interface (function declaration) here is +- what I want, the
> implementation shown of course is dummy-code not working. Does boost
> provide a more or less easy way to get this implementation smoothly done?
> C++ is 2003 version, so code must be compatible with e.g. VS 2008.. Note
> that I would know in principle a way how to do implement it myself, which
> involves the creation of a separate class for each number of arguments, but
> that's precisely what I want to avoid and I hope that wheel has already
> been invented in some boost-library :)
>
It'll be much easier if the iterator is Fusion iterator, do you really need
dynamic-ranged args for a member function?
What if the size mismatched? to fill with null args?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net