Fix more unused value warnings

Fix operator >= and <= for tuple of arrays
This commit is contained in:
Jonathan 2021-10-05 23:40:40 -04:00
parent e72934de81
commit 75bcccada1
2 changed files with 22 additions and 22 deletions

View File

@ -395,13 +395,6 @@ inline std::ostream &operator<=(std::ostream &s, const double &c)
return s;
}
template<typename... T>
inline std::ostream &operator<=(std::ostream &s, std::tuple<T&...> tuple)
{
std::apply([&s](auto &&...args) { ((s <= args), ...); }, tuple);
return s;
}
template<typename T, size_t N>
inline std::ostream &operator<=(std::ostream &s, const std::array<T, N> &c)
{
@ -411,6 +404,13 @@ inline std::ostream &operator<=(std::ostream &s, const std::array<T, N> &c)
return s;
}
template<typename... T>
inline std::ostream &operator<=(std::ostream &s, std::tuple<T&...> tuple)
{
std::apply([&s](auto &&...args) { ((s <= args), ...); }, tuple);
return s;
}
template<typename T>
inline std::enable_if_t<std::is_member_function_pointer_v<decltype(&T::stream_data)>, 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<typename... T>
inline std::istream &operator>=(std::istream &s, std::tuple<T&...> tuple)
{
std::apply([&s](auto &&...args) { ((s >= args), ...); }, tuple);
return s;
}
template<typename T, size_t N>
inline std::istream &operator>=(std::istream &s, std::array<T, N> &c)
{
@ -530,6 +523,13 @@ inline std::istream &operator>=(std::istream &s, std::array<T, N> &c)
return s;
}
template<typename... T>
inline std::istream &operator>=(std::istream &s, std::tuple<T&...> tuple)
{
std::apply([&s](auto &&...args) { ((s >= args), ...); }, tuple);
return s;
}
template<typename T>
inline std::enable_if_t<std::is_member_function_pointer_v<decltype(&T::stream_data)>, std::istream &> operator>=(
std::istream &s, T &obj)

View File

@ -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<typename... Args,
typename = std::enable_if_t<sizeof...(Args) && std::is_convertible_v<std::common_type_t<Args...>, 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<typename T2>