Skip to content

Commit

Permalink
make variant index casts more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyMusatkin committed Jul 2, 2024
1 parent 6351069 commit 33f7b72
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions include/aws/crt/Variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ namespace Aws
{
AWS_FATAL_ASSERT(other.m_index != -1);
m_index = other.m_index;
VisitorUtil<0, Ts...>::VisitBinary(this, other, CopyMoveConstructor());
VisitorUtil<(Variant::IndexT)0, Ts...>::VisitBinary(this, other, CopyMoveConstructor());
}

Variant(Variant &&other)
{
AWS_FATAL_ASSERT(other.m_index != -1);
m_index = other.m_index;
VisitorUtil<0, Ts...>::VisitBinary(this, std::move(other), CopyMoveConstructor());
VisitorUtil<(Variant::IndexT)0, Ts...>::VisitBinary(this, std::move(other), CopyMoveConstructor());
}

template <typename T, EnableIfOtherIsThisVariantAlternative<T> = 1> Variant(const T &val)
Expand Down Expand Up @@ -213,11 +213,11 @@ namespace Aws
{
Destroy();
m_index = other.m_index;
VisitorUtil<0, Ts...>::VisitBinary(this, other, CopyMoveConstructor());
VisitorUtil<(Variant::IndexT)0, Ts...>::VisitBinary(this, other, CopyMoveConstructor());
}
else
{
VisitorUtil<0, Ts...>::VisitBinary(this, other, CopyMoveAssigner());
VisitorUtil<(Variant::IndexT)0, Ts...>::VisitBinary(this, other, CopyMoveAssigner());
}
}
return *this;
Expand All @@ -232,11 +232,11 @@ namespace Aws
{
Destroy();
m_index = other.m_index;
VisitorUtil<0, Ts...>::VisitBinary(this, std::move(other), CopyMoveConstructor());
VisitorUtil<(Variant::IndexT)0, Ts...>::VisitBinary(this, std::move(other), CopyMoveConstructor());
}
else
{
VisitorUtil<0, Ts...>::VisitBinary(this, std::move(other), CopyMoveAssigner());
VisitorUtil<(Variant::IndexT)0, Ts...>::VisitBinary(this, std::move(other), CopyMoveAssigner());
};
}
return *this;
Expand Down Expand Up @@ -386,7 +386,7 @@ namespace Aws

template <typename VisitorT> void Visit(VisitorT &&visitor)
{
return VisitorUtil<0, Ts...>::Visit(this, std::forward<VisitorT>(visitor));
return VisitorUtil<(Variant::IndexT)0, Ts...>::Visit(this, std::forward<VisitorT>(visitor));
}

private:
Expand Down Expand Up @@ -473,7 +473,7 @@ namespace Aws
}
else
{
VisitorUtil<Index + 1, Second, Rest...>::Visit(pThis, std::forward<VisitorStruct>(visitor));
VisitorUtil<Index + (IndexT)1, Second, Rest...>::Visit(pThis, std::forward<VisitorStruct>(visitor));
}
}

Expand All @@ -490,7 +490,7 @@ namespace Aws
}
else
{
VisitorUtil<Index + 1, Second, Rest...>::VisitBinary(
VisitorUtil<Index + (IndexT)1, Second, Rest...>::VisitBinary(
pThis, std::forward<Variant<Ts...>>(other), std::forward<VisitorStruct>(visitor));
}
}
Expand All @@ -509,7 +509,7 @@ namespace Aws
}
else
{
VisitorUtil<Index + 1, Second, Rest...>::VisitBinary(
VisitorUtil<Index + (IndexT)1, Second, Rest...>::VisitBinary(
pThis, other, std::forward<VisitorStruct>(visitor));
}
}
Expand Down

0 comments on commit 33f7b72

Please sign in to comment.