> On Jan. 4, 2016, 6:26 p.m., Joris Van Remoortere wrote:
> > Looks good. How did you choose the particular functions to make constexpr.
> > Why not the units for example? or others?
>
> Benjamin Bannier wrote:
> The goal was to provide `constexpr` versions of `Duration::min`,
> `Duration::max`, and `Duration::zero`. The latter requires a `constexpr`
> default ctr for `Duration`, the two former ones `constexpr` ctrs for both
> `NanoSeconds` and for `Duration(int64_t, int64_t)`. For consistency I made
> most ctrs `constexpr`.
>
> What do you mean by units here?
>
> Joris Van Remoortere wrote:
> For example:
> `static std::string units() { return "hrs"; }`
Ah, I see. That would have extended the scope of this RR quite a bit.
Note that since `std::string` does not provide a `constexpr` ctr, we'd have to
change to e.g.,
static constexpr const char* units() { return "hrs"; }
which would cut some runtime cost since the literal would come from the RO
section. I am not sure the `constexpr` adds much though since I cannot imagine
a use case where we'd use the value as e.g., a template argument.
Is that something which you think should be implemented here and now?
- Benjamin
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/41881/#review112609
-----------------------------------------------------------
On Jan. 4, 2016, 6:43 p.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/41881/
> -----------------------------------------------------------
>
> (Updated Jan. 4, 2016, 6:43 p.m.)
>
>
> Review request for mesos, Joris Van Remoortere, Till Toenshoff, and Jiang Yan
> Xu.
>
>
> Bugs: MESOS-4277
> https://issues.apache.org/jira/browse/MESOS-4277
>
>
> Repository: mesos
>
>
> Description
> -------
>
> For that we need to provide a constexpr constructor for Nanoseconds at
> least; make all constructors of Duration types constexpr if possible.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp
> dc610e697032f0d5d9c7a6524aeb34984041dec7
>
> Diff: https://reviews.apache.org/r/41881/diff/
>
>
> Testing
> -------
>
> make check (OS X 10.10.5).
>
>
> Thanks,
>
> Benjamin Bannier
>
>