2010/1/13 noman javed <noman_bwp@yahoo.com>
We want to hide from user the creation of the vector. The user just need to call the execute function like that execute(FOB,bar1,bar2,...,barn). Where the FOB is any function object followed by the original data.

You can do that, but execute must be a function object instead of function.

#include <boost/fusion/functional/adapter/unfused.hpp>

struct execute_impl
{
    template <class Seq>
    struct result
    {
        typedef void type;
    };

    template <class Seq>
    void operator()(Seq const & s) const
    {
        // s contains all arguments passed to execute.
    }
};

boost::fusion::unfused<execute_impl> execute;

int main()
{
    const char* s = "hello";
    int n = 42;
    execute(s, n);
}

Here "execute" suffers from perfect forwarding problem, which you can solve by using perfect forwarding adaptor. There is one in p-stade and also I remember seeing one being proposed for boost, but I can't find it.

Roman Perepelitsa.