> On Jan. 3, 2016, 11:55 p.m., Benjamin Hindman wrote:
> > 3rdparty/libprocess/include/process/future.hpp, lines 228-230
> > <https://reviews.apache.org/r/41460/diff/1/?file=1166979#file1166979line228>
> >
> >     Why do we need to capture/alias the type `F` as `G` again and then use 
> > it in `std::result_of<G()>::type`? Why can't we just use `F` there again?
> 
> Michael Park wrote:
>     We could if there was a guarantee that the default template arguments are 
> instantiated left-to-right. I'm not sure whether such guarantee exists and 
> would prefer not rely on it even if it did.
>     
>     This way, it's required that the default argument to `G` be instantiated 
> first, and there's no chance of `std::result_of` being instantiated with `F` 
> if `F` is the result of a `std::bind`.

Synced with BenH offline about this. The SFINAE evaluation is not guaranteed to 
be performed in lexical order until C++14. Once we get to C++14 we can write 
something like:

```cpp
template <
    typename F,
    typename = typename std::enable_if<!std::is_bind_expression<
        typename std::decay<F>::type>::value>::type,
    typename = typename std::result_of<F()>::type>
...
```

Meanwhile, we simply inline the `G`.


- Michael


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41460/#review112480
-----------------------------------------------------------


On Jan. 6, 2016, 2:27 a.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41460/
> -----------------------------------------------------------
> 
> (Updated Jan. 6, 2016, 2:27 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman, Alex Clemmer, and Joris Van 
> Remoortere.
> 
> 
> Bugs: MESOS-4228
>     https://issues.apache.org/jira/browse/MESOS-4228
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The Standard (C++11 through 17) does not require `std::bind`'s function call 
> operator to SFINAE, and VS 2015's doesn't. `std::is_bind_expression` can be 
> used to manually reroute bind expressions to the 1-arg overload, where 
> (conveniently) the argument will be ignored if necessary.
> 
> Follow-up from [r40114](https://reviews.apache.org/r/40114/).
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/future.hpp 
> bcb5668565298825056f1b48d48efe12d2e56e7c 
> 
> Diff: https://reviews.apache.org/r/41460/diff/
> 
> 
> Testing
> -------
> 
> `make check` on OS X, compiled on Windows.
> 
> 
> Thanks,
> 
> Michael Park
> 
>

Reply via email to