You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Michael Park <mp...@apache.org> on 2015/12/16 20:47:19 UTC
Review Request 41461: stout: Added SFINAE-friendly `result_of`.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/
-----------------------------------------------------------
Review request for mesos, Alex Clemmer and Joris Van Remoortere.
Repository: mesos
Description (updated)
-------
VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
Here, we implement SFINAE `result_of` in `stout`.
Follow-up from [r40114](https://reviews.apache.org/r/40114/).
Diffs
-----
Diff: https://reviews.apache.org/r/41461/diff/
Testing (updated)
-------
`make check` on OS X, compiled on Windows.
Thanks,
Michael Park
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Alexander Rukletsov <ru...@gmail.com>.
> On Jan. 4, 2016, 5:30 p.m., Alexander Rojas wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp, line 41
> > <https://reviews.apache.org/r/41461/diff/5/?file=1174022#file1174022line41>
> >
> > my question here is, why does `result_of_type` needs to take parameters?, just so `fail result_of_type` can take and then ignore them?
Looks like the compiler cannot disambiguate between `<ret-type> foo(...)` and `<ret-type> foo()` because there is no conversion happening (my guess is based on a note in http://en.cppreference.com/w/cpp/language/variadic_arguments). MPark, looks like a comment here can be really helpful : ).
- Alexander
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/#review112599
-----------------------------------------------------------
On Dec. 28, 2015, 3:42 p.m., Michael Park wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41461/
> -----------------------------------------------------------
>
> (Updated Dec. 28, 2015, 3:42 p.m.)
>
>
> Review request for mesos, Alex Clemmer and Joris Van Remoortere.
>
>
> Bugs: MESOS-4220
> https://issues.apache.org/jira/browse/MESOS-4220
>
>
> Repository: mesos
>
>
> Description
> -------
>
> VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
>
> Here, we implement SFINAE `result_of` in `stout`.
>
> Follow-up from [r40114](https://reviews.apache.org/r/40114/).
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/include/Makefile.am b2dea9b93adfa3ea0415a0b5c81a369dd29b6cfe
> 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
>
> Diff: https://reviews.apache.org/r/41461/diff/
>
>
> Testing
> -------
>
> `make check` on OS X, compiled on Windows.
>
>
> Thanks,
>
> Michael Park
>
>
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Michael Park <mp...@apache.org>.
> On Jan. 4, 2016, 5:30 p.m., Alexander Rojas wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp, line 41
> > <https://reviews.apache.org/r/41461/diff/5/?file=1174022#file1174022line41>
> >
> > my question here is, why does `result_of_type` needs to take parameters?, just so `fail result_of_type` can take and then ignore them?
>
> Alexander Rukletsov wrote:
> Looks like the compiler cannot disambiguate between `<ret-type> foo(...)` and `<ret-type> foo()` because there is no conversion happening (my guess is based on a note in http://en.cppreference.com/w/cpp/language/variadic_arguments). MPark, looks like a comment here can be really helpful : ).
If the expression SFINAEs out the non-`fail` version, then we're only left with the `fail` version and we use that. If the expression __does not__ SFINAE out the non-`fail` version, then we have both overloads in the overload set, and we want the non-`fail` version to win. In order to achieve this we pass `int` is a better match than `...` with `0` as the argument, so it wins overload resolution.
I've updated this to use the pattern in `future.hpp` instead, which is `Prefer` and `LessPrefer`. It's the same concept. `Prefer` inherits from `LessPrefer`, so they are both viable, but `Prefer` is a better match than `LessPrefer` with `Prefer()` as the argument.
- Michael
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/#review112599
-----------------------------------------------------------
On Jan. 6, 2016, 12:55 a.m., Michael Park wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41461/
> -----------------------------------------------------------
>
> (Updated Jan. 6, 2016, 12:55 a.m.)
>
>
> Review request for mesos, Benjamin Hindman, Alex Clemmer, and Joris Van Remoortere.
>
>
> Bugs: MESOS-4220
> https://issues.apache.org/jira/browse/MESOS-4220
>
>
> Repository: mesos
>
>
> Description
> -------
>
> VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
>
> Here, we implement SFINAE `result_of` in `stout`.
>
> Follow-up from [r40114](https://reviews.apache.org/r/40114/).
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/include/Makefile.am b2dea9b93adfa3ea0415a0b5c81a369dd29b6cfe
> 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
>
> Diff: https://reviews.apache.org/r/41461/diff/
>
>
> Testing
> -------
>
> `make check` on OS X, compiled on Windows.
>
>
> Thanks,
>
> Michael Park
>
>
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Alexander Rojas <al...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/#review112599
-----------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp (line 32)
<https://reviews.apache.org/r/41461/#comment173100>
In which cases is the Substitution Failure an actuall error? when `F` is not callable/pointer to member?
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp (line 41)
<https://reviews.apache.org/r/41461/#comment173099>
my question here is, why does `result_of_type` needs to take parameters?, just so `fail result_of_type` can take and then ignore them?
- Alexander Rojas
On Dec. 28, 2015, 4:42 p.m., Michael Park wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41461/
> -----------------------------------------------------------
>
> (Updated Dec. 28, 2015, 4:42 p.m.)
>
>
> Review request for mesos, Alex Clemmer and Joris Van Remoortere.
>
>
> Bugs: MESOS-4220
> https://issues.apache.org/jira/browse/MESOS-4220
>
>
> Repository: mesos
>
>
> Description
> -------
>
> VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
>
> Here, we implement SFINAE `result_of` in `stout`.
>
> Follow-up from [r40114](https://reviews.apache.org/r/40114/).
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/include/Makefile.am b2dea9b93adfa3ea0415a0b5c81a369dd29b6cfe
> 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
>
> Diff: https://reviews.apache.org/r/41461/diff/
>
>
> Testing
> -------
>
> `make check` on OS X, compiled on Windows.
>
>
> Thanks,
>
> Michael Park
>
>
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Michael Park <mp...@apache.org>.
> On Dec. 28, 2015, 5:33 p.m., Alexander Rukletsov wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp, lines 21-22
> > <https://reviews.apache.org/r/41461/diff/5/?file=1174022#file1174022line21>
> >
> > Do you want to reference MESOS-3993? Maybe update the ticket as well, once this lands.
Done. I think we'll probably turn MESOS-3993 into a more general, "switch back to `std::result_of`"
> On Dec. 28, 2015, 5:33 p.m., Alexander Rukletsov wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp, lines 33-34
> > <https://reviews.apache.org/r/41461/diff/5/?file=1174022#file1174022line33>
> >
> > Let's make a note that `std::invoke()`, which is c++17 AFAIK, is supported by msvc 2015 and it's not in <functional>.
Done.
```
// `std::invoke` is a C++17 feature, but we only compile this code for Windows,
// which has it implemented in VS 2015 Update 1. It is also supposed to be
// defined in `<functional>`, but is included in `<utility>` in VS.
```
> On Dec. 28, 2015, 5:33 p.m., Alexander Rukletsov wrote:
> > 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp, line 41
> > <https://reviews.apache.org/r/41461/diff/5/?file=1174022#file1174022line41>
> >
> > `int` is dummy here, right? Mind writing a comment about it?
I changed it to using the `Prefer`, and `LessPrefer` which already exists in `<process/future.hpp>`. Left a comment to factor these out later.
- Michael
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/#review111984
-----------------------------------------------------------
On Jan. 6, 2016, 12:55 a.m., Michael Park wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41461/
> -----------------------------------------------------------
>
> (Updated Jan. 6, 2016, 12:55 a.m.)
>
>
> Review request for mesos, Benjamin Hindman, Alex Clemmer, and Joris Van Remoortere.
>
>
> Bugs: MESOS-4220
> https://issues.apache.org/jira/browse/MESOS-4220
>
>
> Repository: mesos
>
>
> Description
> -------
>
> VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
>
> Here, we implement SFINAE `result_of` in `stout`.
>
> Follow-up from [r40114](https://reviews.apache.org/r/40114/).
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/include/Makefile.am b2dea9b93adfa3ea0415a0b5c81a369dd29b6cfe
> 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
>
> Diff: https://reviews.apache.org/r/41461/diff/
>
>
> Testing
> -------
>
> `make check` on OS X, compiled on Windows.
>
>
> Thanks,
>
> Michael Park
>
>
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Alexander Rukletsov <ru...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/#review111984
-----------------------------------------------------------
Do you think it makes sense to add some configure checks?
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp (lines 21 - 22)
<https://reviews.apache.org/r/41461/#comment172296>
Do you want to reference MESOS-3993? Maybe update the ticket as well, once this lands.
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp (lines 33 - 34)
<https://reviews.apache.org/r/41461/#comment172298>
Let's make a note that `std::invoke()`, which is c++17 AFAIK, is supported by msvc 2015 and it's not in <functional>.
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp (line 41)
<https://reviews.apache.org/r/41461/#comment172314>
`int` is dummy here, right? Mind writing a comment about it?
- Alexander Rukletsov
On Dec. 28, 2015, 3:42 p.m., Michael Park wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41461/
> -----------------------------------------------------------
>
> (Updated Dec. 28, 2015, 3:42 p.m.)
>
>
> Review request for mesos, Alex Clemmer and Joris Van Remoortere.
>
>
> Bugs: MESOS-4220
> https://issues.apache.org/jira/browse/MESOS-4220
>
>
> Repository: mesos
>
>
> Description
> -------
>
> VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
>
> Here, we implement SFINAE `result_of` in `stout`.
>
> Follow-up from [r40114](https://reviews.apache.org/r/40114/).
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/include/Makefile.am b2dea9b93adfa3ea0415a0b5c81a369dd29b6cfe
> 3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
>
> Diff: https://reviews.apache.org/r/41461/diff/
>
>
> Testing
> -------
>
> `make check` on OS X, compiled on Windows.
>
>
> Thanks,
>
> Michael Park
>
>
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/
-----------------------------------------------------------
(Updated Dec. 28, 2015, 3:42 p.m.)
Review request for mesos, Alex Clemmer and Joris Van Remoortere.
Bugs: MESOS-4220
https://issues.apache.org/jira/browse/MESOS-4220
Repository: mesos
Description
-------
VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
Here, we implement SFINAE `result_of` in `stout`.
Follow-up from [r40114](https://reviews.apache.org/r/40114/).
Diffs
-----
3rdparty/libprocess/3rdparty/stout/include/Makefile.am b2dea9b93adfa3ea0415a0b5c81a369dd29b6cfe
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
Diff: https://reviews.apache.org/r/41461/diff/
Testing
-------
`make check` on OS X, compiled on Windows.
Thanks,
Michael Park
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/
-----------------------------------------------------------
(Updated Dec. 21, 2015, 6:10 p.m.)
Review request for mesos, Alex Clemmer and Joris Van Remoortere.
Repository: mesos
Description
-------
VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
Here, we implement SFINAE `result_of` in `stout`.
Follow-up from [r40114](https://reviews.apache.org/r/40114/).
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/stout/include/Makefile.am b2dea9b93adfa3ea0415a0b5c81a369dd29b6cfe
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
Diff: https://reviews.apache.org/r/41461/diff/
Testing
-------
`make check` on OS X, compiled on Windows.
Thanks,
Michael Park
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/
-----------------------------------------------------------
(Updated Dec. 16, 2015, 8:05 p.m.)
Review request for mesos, Alex Clemmer and Joris Van Remoortere.
Repository: mesos
Description
-------
VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
Here, we implement SFINAE `result_of` in `stout`.
Follow-up from [r40114](https://reviews.apache.org/r/40114/).
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/stout/include/Makefile.am d1ef6f0df82e83d8e0d38f7b8986403702519a7d
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
Diff: https://reviews.apache.org/r/41461/diff/
Testing
-------
`make check` on OS X, compiled on Windows.
Thanks,
Michael Park
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/
-----------------------------------------------------------
(Updated Dec. 16, 2015, 8:03 p.m.)
Review request for mesos, Alex Clemmer and Joris Van Remoortere.
Repository: mesos
Description
-------
VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
Here, we implement SFINAE `result_of` in `stout`.
Follow-up from [r40114](https://reviews.apache.org/r/40114/).
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/stout/include/Makefile.am d1ef6f0df82e83d8e0d38f7b8986403702519a7d
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
Diff: https://reviews.apache.org/r/41461/diff/
Testing
-------
`make check` on OS X, compiled on Windows.
Thanks,
Michael Park
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/
-----------------------------------------------------------
(Updated Dec. 16, 2015, 7:57 p.m.)
Review request for mesos, Alex Clemmer and Joris Van Remoortere.
Changes
-------
Added comments.
Repository: mesos
Description
-------
VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
Here, we implement SFINAE `result_of` in `stout`.
Follow-up from [r40114](https://reviews.apache.org/r/40114/).
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/stout/include/Makefile.am d1ef6f0df82e83d8e0d38f7b8986403702519a7d
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
Diff: https://reviews.apache.org/r/41461/diff/
Testing
-------
`make check` on OS X, compiled on Windows.
Thanks,
Michael Park
Re: Review Request 41461: stout: Added SFINAE-friendly `result_of`.
Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41461/
-----------------------------------------------------------
(Updated Dec. 16, 2015, 7:50 p.m.)
Review request for mesos, Alex Clemmer and Joris Van Remoortere.
Repository: mesos
Description
-------
VS 2015 won't support C++14 `std::result_of` SFINAE until Update 2, so `result_of` must be replaced with `decltype(invoke)`.
Here, we implement SFINAE `result_of` in `stout`.
Follow-up from [r40114](https://reviews.apache.org/r/40114/).
Diffs (updated)
-----
3rdparty/libprocess/3rdparty/stout/include/Makefile.am d1ef6f0df82e83d8e0d38f7b8986403702519a7d
3rdparty/libprocess/3rdparty/stout/include/stout/result_of.hpp PRE-CREATION
Diff: https://reviews.apache.org/r/41461/diff/
Testing
-------
`make check` on OS X, compiled on Windows.
Thanks,
Michael Park