Skip to content

Commit

Permalink
Avoid requires when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
wichtounet committed Dec 10, 2023
1 parent 54a37d6 commit fe56849
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions include/etl/builder/binary_expression_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ auto operator%(LE&& lhs, RE&& rhs) {
* \param rhs The right hand side expression
* \return An expression representing the subtraction of lhs and rhs (scalar)
*/
template <etl_expr LE, typename RE>
auto operator-(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
template <etl_expr LE, std::convertible_to<value_t<LE>> RE>
auto operator-(LE&& lhs, RE rhs) {
return detail::left_binary_helper<LE, scalar<value_t<LE>>, minus_binary_op>{std::forward<LE>(lhs), scalar<value_t<LE>>(rhs)};
}

Expand All @@ -112,8 +112,8 @@ auto operator-(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
* \param rhs The right hand side expression
* \return An expression representing the subtraction of lhs (scalar) and rhs
*/
template <typename LE, etl_expr RE>
auto operator-(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
template <etl_expr RE, std::convertible_to<value_t<RE>> LE>
auto operator-(LE lhs, RE&& rhs) {
return detail::right_binary_helper<scalar<value_t<RE>>, RE, minus_binary_op>{scalar<value_t<RE>>(lhs), std::forward<RE>(rhs)};
}

Expand All @@ -123,8 +123,8 @@ auto operator-(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
* \param rhs The right hand side expression
* \return An expression representing the addition of lhs and rhs (scalar)
*/
template <etl_expr LE, typename RE>
auto operator+(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
template <etl_expr LE, std::convertible_to<value_t<LE>> RE>
auto operator+(LE&& lhs, RE rhs) {
return detail::left_binary_helper<LE, scalar<value_t<LE>>, plus_binary_op> {std::forward<LE>(lhs), scalar<value_t<LE>>(rhs)};
}

Expand All @@ -134,8 +134,8 @@ auto operator+(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
* \param rhs The right hand side expression
* \return An expression representing the addition of lhs (scalar) and rhs
*/
template <typename LE, etl_expr RE>
auto operator+(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
template <etl_expr RE, std::convertible_to<value_t<RE>> LE>
auto operator+(LE lhs, RE&& rhs) {
return detail::right_binary_helper<scalar<value_t<RE>>, RE, plus_binary_op> {scalar<value_t<RE>>(lhs), std::forward<RE>(rhs)};
}

Expand All @@ -145,8 +145,8 @@ auto operator+(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
* \param rhs The right hand side expression
* \return An expression representing the multiplication of lhs and rhs (scalar)
*/
template <etl_expr LE, typename RE>
auto operator*(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
template <etl_expr LE, std::convertible_to<value_t<LE>> RE>
auto operator*(LE&& lhs, RE rhs) {
return detail::left_binary_helper<LE, scalar<value_t<LE>>, mul_binary_op> {std::forward<LE>(lhs), scalar<value_t<LE>>(rhs)};
}

Expand All @@ -156,8 +156,8 @@ auto operator*(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
* \param rhs The right hand side expression
* \return An expression representing the multiplication of lhs (scalar) and rhs
*/
template <typename LE, etl_expr RE>
auto operator*(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
template <etl_expr RE, std::convertible_to<value_t<RE>> LE>
auto operator*(LE lhs, RE&& rhs) {
return detail::right_binary_helper<scalar<value_t<RE>>, RE, mul_binary_op> {scalar<value_t<RE>>(lhs), std::forward<RE>(rhs)};
}

Expand All @@ -167,8 +167,8 @@ auto operator*(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
* \param rhs The right hand side expression
* \return An expression representing the multiplication of lhs and rhs (scalar)
*/
template <etl_expr LE, typename RE>
auto operator>>(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
template <etl_expr LE, std::convertible_to<value_t<LE>> RE>
auto operator>>(LE&& lhs, RE rhs) {
return detail::left_binary_helper<LE, scalar<value_t<LE>>, mul_binary_op> {std::forward<LE>(lhs), scalar<value_t<LE>>(rhs)};
}

Expand All @@ -178,8 +178,8 @@ auto operator>>(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>>
* \param rhs The right hand side expression
* \return An expression representing the multiplication of lhs (scalar) and rhs
*/
template <typename LE, etl_expr RE>
auto operator>>(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
template <etl_expr RE, std::convertible_to<value_t<RE>> LE>
auto operator>>(LE lhs, RE&& rhs) {
return detail::right_binary_helper<scalar<value_t<RE>>, RE, mul_binary_op> {scalar<value_t<RE>>(lhs), std::forward<RE>(rhs)};
}

Expand All @@ -189,8 +189,8 @@ auto operator>>(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>>
* \param rhs The right hand side expression
* \return An expression representing the division of lhs and rhs (scalar)
*/
template <etl_expr LE, typename RE>
auto operator/(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
template <etl_expr LE, std::convertible_to<value_t<LE>> RE>
auto operator/(LE&& lhs, RE rhs) {
if constexpr (is_div_strict || !std::floating_point<RE>) {
return detail::left_binary_helper<LE, scalar<value_t<LE>>, div_binary_op> {std::forward<LE>(lhs), scalar<value_t<LE>>(rhs)};
} else {
Expand All @@ -204,8 +204,8 @@ auto operator/(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
* \param rhs The right hand side expression
* \return An expression representing the division of lhs (scalar) and rhs
*/
template <typename LE, etl_expr RE>
auto operator/(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>>{
template <etl_expr RE, std::convertible_to<value_t<RE>> LE>
auto operator/(LE lhs, RE&& rhs) {
return detail::right_binary_helper<scalar<value_t<RE>>, RE, div_binary_op> {scalar<value_t<RE>>(lhs), std::forward<RE>(rhs)};
}

Expand All @@ -215,8 +215,8 @@ auto operator/(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>>{
* \param rhs The right hand side expression
* \return An expression representing the modulo of lhs and rhs (scalar)
*/
template <etl_expr LE, typename RE>
auto operator%(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
template <etl_expr LE, std::convertible_to<value_t<LE>> RE>
auto operator%(LE&& lhs, RE rhs) {
return detail::left_binary_helper<LE, scalar<value_t<LE>>, mod_binary_op> {std::forward<LE>(lhs), scalar<value_t<LE>>(rhs)};
}

Expand All @@ -226,8 +226,8 @@ auto operator%(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
* \param rhs The right hand side expression
* \return An expression representing the modulo of lhs (scalar) and rhs
*/
template <typename LE, etl_expr RE>
auto operator%(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
template <etl_expr RE, std::convertible_to<value_t<RE>> LE>
auto operator%(LE lhs, RE&& rhs) {
return detail::right_binary_helper<scalar<value_t<RE>>, RE, mod_binary_op> {scalar<value_t<RE>>(lhs), std::forward<RE>(rhs)};
}

Expand Down Expand Up @@ -470,8 +470,8 @@ auto logical_and(LE&& lhs, RE&& rhs) {
* \param rhs The right hand side expression
* \return An expression representing the element wise logical and of lhs and rhs (scalar)
*/
template <etl_expr LE, typename RE>
auto logical_and(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
template <etl_expr LE, std::convertible_to<value_t<LE>> RE>
auto logical_and(LE&& lhs, RE rhs) {
return detail::bool_left_binary_helper<LE, scalar<value_t<LE>>, logical_and_binary_op> {lhs, scalar<value_t<LE>>(rhs)};
}

Expand All @@ -481,8 +481,8 @@ auto logical_and(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>>
* \param rhs The right hand side expression
* \return An expression representing the element wise logical and of lhs (scalar) and rhs
*/
template <typename LE, etl_expr RE>
auto logical_and(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
template <etl_expr RE, std::convertible_to<value_t<RE>> LE>
auto logical_and(LE lhs, RE&& rhs) {
return detail::bool_right_binary_helper<scalar<value_t<RE>>, RE, logical_and_binary_op> {scalar<value_t<RE>>(lhs), rhs};
}

Expand All @@ -503,8 +503,8 @@ auto logical_xor(LE&& lhs, RE&& rhs) {
* \param rhs The right hand side expression
* \return An expression representing the element wise logical xor of lhs and rhs (scalar)
*/
template <etl_expr LE, typename RE>
auto logical_xor(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
template <etl_expr LE, std::convertible_to<value_t<LE>> RE>
auto logical_xor(LE&& lhs, RE rhs) {
return detail::bool_left_binary_helper<LE, scalar<value_t<LE>>, logical_xor_binary_op> {lhs, scalar<value_t<LE>>(rhs)};
}

Expand All @@ -514,8 +514,8 @@ auto logical_xor(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>>
* \param rhs The right hand side expression
* \return An expression representing the element wise logical xor of lhs (scalar) and rhs
*/
template <typename LE, etl_expr RE>
auto logical_xor(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
template <etl_expr RE, std::convertible_to<value_t<RE>> LE>
auto logical_xor(LE lhs, RE&& rhs) {
return detail::bool_right_binary_helper<scalar<value_t<RE>>, RE, logical_xor_binary_op> {scalar<value_t<RE>>(lhs), rhs};
}

Expand All @@ -536,8 +536,8 @@ auto logical_or(LE&& lhs, RE&& rhs) {
* \param rhs The right hand side expression
* \return An expression representing the element wise logical or of lhs and rhs (scalar)
*/
template <etl_expr LE, typename RE>
auto logical_or(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>> {
template <etl_expr LE, std::convertible_to<value_t<LE>> RE>
auto logical_or(LE&& lhs, RE rhs) {
return detail::bool_left_binary_helper<LE, scalar<value_t<LE>>, logical_or_binary_op> {lhs, scalar<value_t<LE>>(rhs)};
}

Expand All @@ -547,8 +547,8 @@ auto logical_or(LE&& lhs, RE rhs) requires std::convertible_to<RE, value_t<LE>>
* \param rhs The right hand side expression
* \return An expression representing the element wise logical or of lhs (scalar) and rhs
*/
template <typename LE, etl_expr RE>
auto logical_or(LE lhs, RE&& rhs) requires std::convertible_to<LE, value_t<RE>> {
template <etl_expr RE, std::convertible_to<value_t<RE>> LE>
auto logical_or(LE lhs, RE&& rhs) {
return detail::bool_right_binary_helper<scalar<value_t<RE>>, RE, logical_or_binary_op> {scalar<value_t<RE>>(lhs), rhs};
}

Expand Down

0 comments on commit fe56849

Please sign in to comment.