Skip to content

Commit

Permalink
[Bugfix] IAssociativeAndCommutative (open-algebra#56)
Browse files Browse the repository at this point in the history
* Fixed the concept IAssociativeAndCommutative, and made GetStaticCategory
a consexpr

* fixed formating

---------

Co-authored-by: Benjamin Yankowitz <ben@DESKTOP-VBLHJ5F>
  • Loading branch information
BenjaminYankowitz and Benjamin Yankowitz authored Mar 12, 2024
1 parent 14fafc1 commit efa4b62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/Oasis/BinaryExpression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ template <typename MostSigOpT, typename LeastSigOpT, typename T>
concept IOperand = std::is_same_v<T, MostSigOpT> || std::is_same_v<T, LeastSigOpT>;

template <template <typename, typename> typename T>
concept IAssociativeAndCommutative = IExpression<T<Expression, Expression>> && requires { (T<Expression, Expression>::GetStaticCategory() & (Associative | Commutative)) != 0; };
concept IAssociativeAndCommutative = IExpression<T<Expression, Expression>> && ((T<Expression, Expression>::GetStaticCategory() & (Associative | Commutative)) == (Associative | Commutative));

template <typename T, typename... U>
concept IsAnyOf = (std::same_as<T, U> || ...);
Expand Down
18 changes: 9 additions & 9 deletions include/Oasis/Expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,15 @@ class Expression {
return ExpressionType::type; \
}

#define EXPRESSION_CATEGORY(category) \
auto GetCategory() const -> uint32_t override \
{ \
return category; \
} \
\
static auto GetStaticCategory() -> uint32_t \
{ \
return category; \
#define EXPRESSION_CATEGORY(category) \
auto GetCategory() const -> uint32_t override \
{ \
return category; \
} \
\
constexpr static auto GetStaticCategory() -> uint32_t \
{ \
return category; \
}

} // namespace Oasis
Expand Down

0 comments on commit efa4b62

Please sign in to comment.