From 75bcccada1dac25dfb7cfea0085b50e7ebd53464 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 5 Oct 2021 23:40:40 -0400 Subject: [PATCH] Fix more unused value warnings Fix operator >= and <= for tuple of arrays --- include/common/cmdlib.hh | 28 ++++++++++++++-------------- include/common/qvec.hh | 16 ++++++++-------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/common/cmdlib.hh b/include/common/cmdlib.hh index ad77b86d..3f837fb5 100644 --- a/include/common/cmdlib.hh +++ b/include/common/cmdlib.hh @@ -395,13 +395,6 @@ inline std::ostream &operator<=(std::ostream &s, const double &c) return s; } -template -inline std::ostream &operator<=(std::ostream &s, std::tuple tuple) -{ - std::apply([&s](auto &&...args) { ((s <= args), ...); }, tuple); - return s; -} - template inline std::ostream &operator<=(std::ostream &s, const std::array &c) { @@ -411,6 +404,13 @@ inline std::ostream &operator<=(std::ostream &s, const std::array &c) return s; } +template +inline std::ostream &operator<=(std::ostream &s, std::tuple tuple) +{ + std::apply([&s](auto &&...args) { ((s <= args), ...); }, tuple); + return s; +} + template inline std::enable_if_t, std::ostream &> operator<=( std::ostream &s, const T &obj) @@ -514,13 +514,6 @@ inline std::istream &operator>=(std::istream &s, double &c) return s; } -template -inline std::istream &operator>=(std::istream &s, std::tuple tuple) -{ - std::apply([&s](auto &&...args) { ((s >= args), ...); }, tuple); - return s; -} - template inline std::istream &operator>=(std::istream &s, std::array &c) { @@ -530,6 +523,13 @@ inline std::istream &operator>=(std::istream &s, std::array &c) return s; } +template +inline std::istream &operator>=(std::istream &s, std::tuple tuple) +{ + std::apply([&s](auto &&...args) { ((s >= args), ...); }, tuple); + return s; +} + template inline std::enable_if_t, std::istream &> operator>=( std::istream &s, T &obj) diff --git a/include/common/qvec.hh b/include/common/qvec.hh index 334b7921..fdca3ae0 100644 --- a/include/common/qvec.hh +++ b/include/common/qvec.hh @@ -43,7 +43,11 @@ public: using value_type = T; constexpr qvec() = default; - + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-value" +#endif template, T>>> constexpr qvec(Args... a) @@ -60,14 +64,7 @@ public: else { constexpr size_t copy_size = qmin(N, count); size_t i = 0; -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-value" -#endif ((i++ < copy_size ? (v[i - 1] = a, true) : false), ...); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif // Bug with MSVC: // https://developercommunity.visualstudio.com/t/stdc20-fatal-error-c1004-unexpected-end-of-file-fo/1509806 constexpr bool fill_rest = count < N; @@ -78,6 +75,9 @@ public: } } } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif // copy from C-style array, exact lengths only template