Boost logo

Boost Users :

Subject: Re: [Boost-users] [bind] Possible to use variadic templates with bind?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2010-07-22 07:36:32


On 07/22/10 04:20, Steve Lorimer wrote:
> 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?

No idea. I've not gotten much feedback, maybe because there's no
documentation??? However, most of the existing mpl docs would apply
to the variadic mpl. Also, I'm having trouble getting the code
to work with spirit. At present, I'm working on converting mpl:;and_
and mpl::or_ and variant to variadic versions in order to get the
code to work with spirit. It's been very tough :(

> 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?)

Do you mean package_range_c? If so, then yes, it is essentially the
same. The only reason for the extra features (arbitrary Value and Start
and Finish template params) is that it seemed easy enough to implement.

>
> I have 3 questions please.
>
[snip]
> 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?

My gcc4.5 gives error:

attempt_2.cpp: In member function 'void func<T, Args>::call(Args ...)':
attempt_2.cpp:47:65: error: expected primary-expression before '...' token

call is not given any arguments, it's only given types. Try

   call(Args... args)

Something similar to that is in section 3.2 of the reference
Peter gave:

   template<typename... Values>
   vector(const Value&... values)

-regards,
Larry


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