[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] use value_or() directly
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] use value_or() directly |
Date: |
Thu, 7 Jun 2018 17:32:15 +0200 |
On Thu, 7 Jun 2018 14:55:52 +0000 Greg Chicares <address@hidden> wrote:
GC> On 2018-06-07 12:46, Vadim Zeitlin wrote:
GC> > On Thu, 7 Jun 2018 06:37:04 -0400 (EDT) Greg Chicares <address@hidden>
wrote:
GC> >
GC> > GC> branch: master
GC> > GC> commit cf7df5333fb2f4f6154aba7d8cd2da8d88565a01
GC> [...]
GC> > GC> template<typename T, typename U>
GC> > GC> inline
GC> > GC> T get_value_or(std::optional<T> const& o, U v)
GC> > GC> {
GC> > GC> - return o ? *o : v;
GC> > GC> + return o.value_or(v);
GC> > GC> }
GC> >
GC> > I don't think we need get_value_or() any more, it was only a replacement
GC> > for the missing value_or() but now that we can use it directly, it only
GC> > makes things less clear.
GC> >
GC> > Please let me know whether I should make a PR replacing get_value_or(o,
v)
GC> > with o.value_or(v) calls or if you prefer to make this trivial change
GC> > yourself.
GC>
GC> Let me make the change.
Thanks!
GC> I'll wait to see whether you have any other comments about other
GC> changes I made to 'rate_table*.?pp'
No, not really. I'm not too happy about the number of new casts but I
trust you've added the minimum required to avoid -Wconversion warnings, so
we'll just have to live with them.
VZ