Skip to content

Commit

Permalink
Simplify type deduction
Browse files Browse the repository at this point in the history
  • Loading branch information
gregtatcam committed Oct 15, 2023
1 parent b1ee726 commit ab729f1
Showing 1 changed file with 4 additions and 29 deletions.
33 changes: 4 additions & 29 deletions src/ripple/app/tx/impl/OfferStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,42 +329,17 @@ TOfferStreamBase<TIn, TOut>::step()
!std::is_same_v<TIn, STAmount> &&
!std::is_same_v<TOut, STAmount>)
return shouldRmSmallIncreasedQOffer<TIn, TOut>();
else if constexpr (
std::is_same_v<TIn, STAmount> &&
!std::is_same_v<TOut, STAmount>)
{
std::visit(
[&]<typename TInAmt>(TInAmt&&) {
ret = shouldRmSmallIncreasedQOffer<
std::decay_t<TInAmt>,
TOut>();
},
toTypedAmt(offer_.amount().in));
return ret;
}
else if constexpr (
!std::is_same_v<TIn, STAmount> &&
std::is_same_v<TOut, STAmount>)
{
std::visit(
[&]<typename TOutAmt>(TOutAmt&&) {
ret = shouldRmSmallIncreasedQOffer<
TIn,
std::decay_t<TOutAmt>>();
},
toTypedAmt(offer_.amount().out));
return ret;
}
else if constexpr (
std::is_same_v<TIn, STAmount> && std::is_same_v<TOut, STAmount>)
{
std::visit(
[&]<typename TInAmt, typename TOutAmt>(
TInAmt&&, TOutAmt&&) {
if constexpr(!std::is_same_v<TInAmt, XRPAmount> ||
if constexpr (
!std::is_same_v<TInAmt, XRPAmount> ||
!std::is_same_v<TOutAmt, XRPAmount>)
ret = shouldRmSmallIncreasedQOffer<
TInAmt, TOutAmt>();
ret =
shouldRmSmallIncreasedQOffer<TInAmt, TOutAmt>();
},
toTypedAmt(offer_.amount().in),
toTypedAmt(offer_.amount().out));
Expand Down

0 comments on commit ab729f1

Please sign in to comment.