Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mikir committed Sep 3, 2024
1 parent 3e768cf commit 4d98593
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions runtime/src/zserio/Variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class BasicVariant : public AllocatorHolder<ALLOC>
using R = decltype(fun(std::declval<detail::type_at<0, T...>::type>()));
if constexpr (std::is_same_v<R, void>)
{
nullptr_t dummy;
std::nullptr_t dummy;
visitSeq(std::forward<F>(fun), dummy, std::make_index_sequence<sizeof...(T)>());
}
else
Expand All @@ -363,7 +363,7 @@ class BasicVariant : public AllocatorHolder<ALLOC>
using R = decltype(fun(std::declval<detail::type_at<0, T...>::type>()));
if constexpr (std::is_same_v<R, void>)
{
nullptr_t dummy;
std::nullptr_t dummy;
visitSeq(std::forward<F>(fun), dummy, std::make_index_sequence<sizeof...(T)>());
}
else
Expand Down Expand Up @@ -444,7 +444,7 @@ class BasicVariant : public AllocatorHolder<ALLOC>
{
if (I != m_data.index())
return;
if constexpr (std::is_same_v<R, nullptr_t>)
if constexpr (std::is_same_v<R, std::nullptr_t>)
{
std::forward<F>(fun)(get<INDEX(I)>());
}
Expand All @@ -459,7 +459,7 @@ class BasicVariant : public AllocatorHolder<ALLOC>
{
if (I != m_data.index())
return;
if constexpr (std::is_same_v<R, nullptr_t>)
if constexpr (std::is_same_v<R, std::nullptr_t>)
{
std::forward<F>(fun)(get<INDEX(I)>());
}
Expand Down
7 changes: 2 additions & 5 deletions runtime/test/zserio/VariantTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,15 @@ struct BigObj
}
bool operator==(const BigObj& o) const
{
return std::equal(std::begin(data), std::end(data), std::begin(o.data));
return data[0] == o.data[0];
}
bool operator!=(const BigObj& o) const
{
return !(*this == o);
}
bool operator<(const BigObj& o) const
{
auto it = std::mismatch(std::begin(data), std::end(data), std::begin(o.data));
if (it.first == std::end(data))
return false;
return *it.first < *it.second;
return data[0] < o.data[0];
}
char data[30];
};
Expand Down

0 comments on commit 4d98593

Please sign in to comment.