Boost logo

Boost Users :

Subject: Re: [Boost-users] Bind/Function: use reference arguments in template variadic functions
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-04-12 19:38:29


AMDG

On 04/12/2013 03:34 PM, Yannick POTIN wrote:
>>
>
> Actually, I try to use template variadic functions which can contains references, pointers and/or values which must be converted to boost::function0<void>.
>
> I tried to use forward() but I lose references with it. I tried ref() to but it make values interpreted as references (so ints are broken). So I'm looking for a magic way to use ref() only when needed by the arguments.
>

What do you mean by "when needed by the arguments?"
How do you specify what should have ref added and
what shouldn't? In other words:

  Given a function f and an argument a, what precisely
  are the conditions on f and a under which you want to
  call bind(f, ref(a)) instead of bind(f, a)?

It's pretty easy to use ref when a is an lvalue, but
this is also dangerous, as it means that apparently
innocent refactoring can change the behavior.

In Christ,
Steven Watanabe


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