Boost logo

Boost Users :

Subject: Re: [Boost-users] Bind/Function: use reference arguments in template variadic functions
From: Yannick POTIN (yannp63_at_[hidden])
Date: 2013-04-12 17:37:44


>

>> template<class ...classes>

>> boost::function0<void> call_something(classes&... c)

>

> Thank you, It actually allows me to use references in these functions.

> I just tried and g++ is waiting for only references but I need to use pointers and/or values too.

> There is a way to use mixed types in template variadic functions ?

>

For perfect forwarding use:

template<class... T>
void call(T&&... t)
{
   foo(std::forward<T>(t)...);
}

I tried this one too and it works fine thank you.

However, I use these functions with boost::bind library and actually references
are lost when I use it (and I need to). After some google searches, it seems that
boost::bind officially does not support this use (due to internal references).
So I tried with std::bind because I read somewhere the problem was fixed with its C++11 version.
The problem is the same : with std::bind too, references are lost using std::forward.

Does anyone made this duo bind/template variadic functions working together ?
And if someone did, how did you do ?

Regards,

Yannick POTIN



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