Skip to content

Commit

Permalink
Adds a static_assert check to TrueDivideInplaceTypeMapFactory
Browse files Browse the repository at this point in the history
Checks that the result type is either the same as the third template parameter, or none

Adds a comment to TrueDivideInplaceOutputType
  • Loading branch information
ndgrigorian committed Oct 10, 2023
1 parent b5c3ee7 commit 237b2d0
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ template <typename argT, typename resT> struct TrueDivideInplaceFunctor
};

// cannot use the out of place table, as it permits real lhs and complex rhs
// T1 corresponds to the type of the rhs, while T2 corresponds to the lhs
// the type of the result must be the same as T2
template <typename T1, typename T2> struct TrueDivideInplaceOutputType
{
using value_type = typename std::disjunction< // disjunction is C++17
Expand Down Expand Up @@ -433,6 +435,7 @@ struct TrueDivideInplaceTypeMapFactory
std::enable_if_t<std::is_same<fnT, int>::value, int> get()
{
using rT = typename TrueDivideInplaceOutputType<T1, T2>::value_type;
static_assert(std::is_same_v<rT, T2> || std::is_same_v<rT, void>);
return td_ns::GetTypeid<rT>{}.get();
}
};
Expand Down

0 comments on commit 237b2d0

Please sign in to comment.