mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From haosdent huang <haosd...@gmail.com>
Subject Re: Review Request 46686: Allowed to pass lambda in `dispatch`.
Date Sat, 04 Jun 2016 16:32:10 GMT


> On June 4, 2016, 10:04 a.m., Michael Park wrote:
> > Another approach would be to:
> > 
> > ```
> > template <typename F, typename R = typename result_of<F()>::type>
> > auto dispatch(const UPID& pid, F&& f)
> >   -> decltype(internal::Dispatch<R>()(pid, std::forward<F>(f)))
> > {
> >   return internal::Dispatch<R>()(pid, std::forward<F>(f));
> > }
> > ```
> > 
> > and to provide specializations for all 3 cases:
> > 
> > ```
> > namespace internal {
> > 
> > template <typename R> struct Dispatch;
> > 
> > template <>           struct Dispatch<void>      { ... };
> > template <typename R> struct Dispatch<Future<R>> { ... };
> > template <typename R> struct Dispatch            { ... };
> > 
> > } // namespace internal {
> > ```
> > 
> > This way we don't have the `std::function<void()>` case, and it's a more consistent
with the overloads defined above.

Awesome! Let me do it in this way.


- haosdent


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


On April 26, 2016, 9:21 a.m., haosdent huang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/46686/
> -----------------------------------------------------------
> 
> (Updated April 26, 2016, 9:21 a.m.)
> 
> 
> Review request for mesos, Kevin Klues and Michael Park.
> 
> 
> Bugs: MESOS-4611
>     https://issues.apache.org/jira/browse/MESOS-4611
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Allowed to pass lambda in `dispatch`.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/include/process/dispatch.hpp a4c35b2a5668df79415dc5156358df3cd0621d11

> 
> Diff: https://reviews.apache.org/r/46686/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> haosdent huang
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message