[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master cf7df53 3/4: Slightly modernize
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master cf7df53 3/4: Slightly modernize |
Date: |
Thu, 7 Jun 2018 06:37:04 -0400 (EDT) |
branch: master
commit cf7df5333fb2f4f6154aba7d8cd2da8d88565a01
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Slightly modernize
---
rate_table.cpp | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/rate_table.cpp b/rate_table.cpp
index 3c8bd83..9038324 100644
--- a/rate_table.cpp
+++ b/rate_table.cpp
@@ -68,10 +68,10 @@
// different from their in memory representation.
static_assert(std::numeric_limits<double>::is_iec559);
+#if 201900L < __cplusplus
+ #error Use std::endian instead when it becomes available.
+#endif // 201900L < __cplusplus
// Helper functions used to swap bytes on big endian platforms.
-//
-// BOOST !! Replace these functions with Boost.Endian library once a version
-// of Boost new enough to have it is used by lmi.
namespace
{
@@ -166,13 +166,11 @@ void to_bytes(char* bytes, T value)
memcpy(bytes, &t, sizeof(T));
}
-// BOOST !! Replace the use of this function with member value_or() present in
-// the later Boost.Optional versions.
template<typename T, typename U>
inline
T get_value_or(std::optional<T> const& o, U v)
{
- return o ? *o : v;
+ return o.value_or(v);
}
// Functions doing the same thing as istream::read() and ostream::write()