[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] use value_or() directly (was: [lmi-commits] master cf7df53 3/4
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] use value_or() directly (was: [lmi-commits] master cf7df53 3/4: Slightly modernize) |
Date: |
Thu, 7 Jun 2018 14:46:15 +0200 |
On Thu, 7 Jun 2018 06:37:04 -0400 (EDT) Greg Chicares <address@hidden> wrote:
GC> branch: master
GC> commit cf7df5333fb2f4f6154aba7d8cd2da8d88565a01
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC>
GC> Slightly modernize
GC> ---
GC> rate_table.cpp | 10 ++++------
GC> 1 file changed, 4 insertions(+), 6 deletions(-)
GC>
GC> diff --git a/rate_table.cpp b/rate_table.cpp
GC> index 3c8bd83..9038324 100644
GC> --- a/rate_table.cpp
GC> +++ b/rate_table.cpp
GC> @@ -68,10 +68,10 @@
GC> // different from their in memory representation.
GC> static_assert(std::numeric_limits<double>::is_iec559);
GC>
GC> +#if 201900L < __cplusplus
GC> + #error Use std::endian instead when it becomes available.
GC> +#endif // 201900L < __cplusplus
GC> // Helper functions used to swap bytes on big endian platforms.
GC> -//
GC> -// BOOST !! Replace these functions with Boost.Endian library once a
version
GC> -// of Boost new enough to have it is used by lmi.
GC> namespace
GC> {
GC>
GC> @@ -166,13 +166,11 @@ void to_bytes(char* bytes, T value)
GC> memcpy(bytes, &t, sizeof(T));
GC> }
GC>
GC> -// BOOST !! Replace the use of this function with member value_or()
present in
GC> -// the later Boost.Optional versions.
GC> template<typename T, typename U>
GC> inline
GC> T get_value_or(std::optional<T> const& o, U v)
GC> {
GC> - return o ? *o : v;
GC> + return o.value_or(v);
GC> }
I don't think we need get_value_or() any more, it was only a replacement
for the missing value_or() but now that we can use it directly, it only
makes things less clear.
Please let me know whether I should make a PR replacing get_value_or(o, v)
with o.value_or(v) calls or if you prefer to make this trivial change
yourself.
Thanks in advance,
VZ
- Re: [lmi] use value_or() directly (was: [lmi-commits] master cf7df53 3/4: Slightly modernize),
Vadim Zeitlin <=