Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] Ambiguity in variadic wait_for_all
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-02-07 23:09:25


On 8/02/2017 06:51, Vicente J. Botet Escriba wrote:
> You have made two changes IIUC, boost version and compiler version, so I
> don't know if this is a regression in boost 1.53 or a behavior that
> different between c++02 and C++11. I suspect that it is the change to
> C++11.

Sorry, I gave a misleading impression there. Both Boost versions were
tested with the same compiler (VS2015), so the issue was introduced by
the Boost upgrade only.

Explicitly disabling the variadic version by defining
BOOST_NO_CXX11_VARIADIC_TEMPLATES also avoids the issue, so I'm pretty
sure it's just the introduction of that which did it.

> Curiously I added enable if only for the function with two arguments,
> but not for the others.

That's correct -- only the two-argument form is ambiguous with the
iterator overload.

Although having said that, the iterator form takes a single template
parameter and the future form takes two template parameters, so the
compiler ought to be able to tell them apart (since the template
parameters were explicitly provided), unless it's trying to infer the
second parameter.

> Please, could you try to add the enable_if to the variadic template and
> tell me if this would fix your issue?
>
> template<typename F1, typename... Fs>
> *typename boost::enable_if<is_future_type<F1>,void>::type*
> wait_for_all(F1& f1, Fs&... fs)

Yes, making that change resolves the ambiguity and the original code
compiles again.


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