Boost logo

Boost Users :

Subject: Re: [Boost-users] [bind] Possible to use variadic templates with bind?
From: Steve Lorimer (steve.lorimer_at_[hidden])
Date: 2010-07-22 05:20:17

Thanks for your input Peter and Larry.

Larry, I'm fearful of using unreleased code. Any idea when your
package_range_c could become part of an official boost release?

With that in mind I'm interested in using Peter's approach (which I'm sure
is very similar to the internals of your package_c hey Larry?)

I have 3 questions please.

1. Please can you give an explanation of what the compiler is actually doing
in your make_func_helper() and make_indexes_...() - This goes beyond my
capabilities at the moment, and I'm always looking to improve my knowledge.

2. In attached file "attempt_1.cpp" at Line 44 - I'm getting a compiler
error "expected primary-expression before '...' token" which I don't
understand. How would I bind the variadic template arguments in order to
create a functor of the form boost::function<void()>?

    void call(Args...)
        boost::function< void() > bound_fn = boost::bind(f, Args...);
        bound_fn(); // in effect the bound_fn will be stored in a queue for
later envocation by a different thread

3. In attached file "attempt_2.cpp" at Line 27, there's a struct cb_ with a
typedef "type" of the member function pointer of the form T::fn(Args...).

    template< class T, class... Args >
    struct cb_ { typedef void (T::*type)(Args...); };

As far as I can see, this is of the same form as Peter's void
(T::*pm)(Args...) member function pointer is it not? How come the compiler
can't match &X::f with typename cb_<T, Args...>::type?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at