Hopefully resolve clang warnings here now
Fix iterator wrapper Fix >= <= tuple<T&> operators
This commit is contained in:
parent
ca0111ce5d
commit
e72934de81
|
|
@ -396,7 +396,7 @@ inline std::ostream &operator<=(std::ostream &s, const double &c)
|
|||
}
|
||||
|
||||
template<typename... T>
|
||||
inline std::ostream &operator<=(std::ostream &s, const std::tuple<T...> &tuple)
|
||||
inline std::ostream &operator<=(std::ostream &s, std::tuple<T&...> tuple)
|
||||
{
|
||||
std::apply([&s](auto &&...args) { ((s <= args), ...); }, tuple);
|
||||
return s;
|
||||
|
|
@ -515,7 +515,7 @@ inline std::istream &operator>=(std::istream &s, double &c)
|
|||
}
|
||||
|
||||
template<typename... T>
|
||||
inline std::istream &operator>=(std::istream &s, std::tuple<T...> &tuple)
|
||||
inline std::istream &operator>=(std::istream &s, std::tuple<T&...> tuple)
|
||||
{
|
||||
std::apply([&s](auto &&...args) { ((s >= args), ...); }, tuple);
|
||||
return s;
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ public:
|
|||
[[nodiscard]] constexpr reference operator*() const noexcept
|
||||
{
|
||||
if (std::holds_alternative<array_iterator>(it))
|
||||
return std::get<array_iterator>(it).operator*();
|
||||
return std::get<vector_iterator>(it).operator*();
|
||||
return *std::get<array_iterator>(it);
|
||||
return *std::get<vector_iterator>(it);
|
||||
}
|
||||
|
||||
constexpr iterator &operator=(const iterator &) noexcept = default;
|
||||
|
|
@ -78,9 +78,9 @@ public:
|
|||
constexpr iterator &operator++() noexcept
|
||||
{
|
||||
if (std::holds_alternative<array_iterator>(it))
|
||||
std::get<array_iterator>(it).operator++();
|
||||
++std::get<array_iterator>(it);
|
||||
else
|
||||
std::get<vector_iterator>(it).operator++();
|
||||
++std::get<vector_iterator>(it);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -88,9 +88,9 @@ public:
|
|||
constexpr iterator &operator++(int) noexcept
|
||||
{
|
||||
if (std::holds_alternative<array_iterator>(it))
|
||||
std::get<array_iterator>(it).operator++(0);
|
||||
std::get<array_iterator>(it)++;
|
||||
else
|
||||
return std::get<vector_iterator>(it).operator++(0);
|
||||
std::get<vector_iterator>(it)++;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -98,9 +98,9 @@ public:
|
|||
constexpr iterator &operator--() noexcept
|
||||
{
|
||||
if (std::holds_alternative<array_iterator>(it))
|
||||
std::get<array_iterator>(it).operator--();
|
||||
--std::get<array_iterator>(it);
|
||||
else
|
||||
std::get<vector_iterator>(it).operator--();
|
||||
--std::get<vector_iterator>(it);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -108,9 +108,9 @@ public:
|
|||
constexpr iterator operator--(int) noexcept
|
||||
{
|
||||
if (std::holds_alternative<array_iterator>(it))
|
||||
std::get<array_iterator>(it).operator--(0);
|
||||
std::get<array_iterator>(it)--;
|
||||
else
|
||||
std::get<vector_iterator>(it).operator--(0);
|
||||
std::get<vector_iterator>(it)--;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -118,9 +118,9 @@ public:
|
|||
constexpr iterator &operator+=(const difference_type _Off) noexcept
|
||||
{
|
||||
if (std::holds_alternative<array_iterator>(it))
|
||||
std::get<array_iterator>(it).operator+=(_Off);
|
||||
std::get<array_iterator>(it) += _Off;
|
||||
else
|
||||
std::get<vector_iterator>(it).operator+=(_Off);
|
||||
std::get<vector_iterator>(it) += _Off;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -135,9 +135,9 @@ public:
|
|||
constexpr iterator &operator-=(const difference_type _Off) noexcept
|
||||
{
|
||||
if (std::holds_alternative<array_iterator>(it))
|
||||
std::get<array_iterator>(it).operator-=(_Off);
|
||||
std::get<array_iterator>(it) -= _Off;
|
||||
else
|
||||
std::get<vector_iterator>(it).operator-=(_Off);
|
||||
std::get<vector_iterator>(it) -= _Off;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,14 @@ public:
|
|||
else {
|
||||
constexpr size_t copy_size = qmin(N, count);
|
||||
size_t i = 0;
|
||||
[[maybe_unused]] auto _ = ((i++ < copy_size ? (v[i - 1] = a, true) : false), ...);
|
||||
#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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue