OASIS
Open Algebra Software
Loading...
Searching...
No Matches
Concepts.hpp
Go to the documentation of this file.
1//
2// Created by Matthew McCall on 10/20/24.
3//
4
5#ifndef OASIS_CONCEPTS_HPP
6#define OASIS_CONCEPTS_HPP
7
8namespace Oasis {
9class Expression;
10enum class ExpressionType;
11
24template <typename T>
25concept IExpression = (requires(T, const Expression& other) {
26 {
27 T::GetStaticCategory()
29 {
30 T::GetStaticType()
33
34template <template <IExpression, IExpression> class DerivedT, IExpression MostSigOpT, IExpression LeastSigOpT>
36
37template <template <IExpression> class DerivedT, IExpression OpT>
38class UnaryExpression;
39
47template <typename T, typename... U>
48concept IsAnyOf = (std::same_as<T, U> || ...);
49
50template <typename Derived>
51concept DerivedFromBinaryExpression = requires(Derived& d) {
52 []<template <IExpression, IExpression> typename D, IExpression T, IExpression U>(BinaryExpression<D, T, U>&) {}(d);
53};
54
55template <typename Derived>
56concept DerivedFromUnaryExpression = requires(Derived& d) {
57 []<template <IExpression> typename D, IExpression T>(UnaryExpression<D, T>&) {}(d);
58};
59
60}
61
62#endif // OASIS_CONCEPTS_HPP
A binary expression.
Definition BinaryExpression.hpp:79
Definition UnaryExpression.hpp:14
Definition Concepts.hpp:51
Definition Concepts.hpp:56
An expression concept.
Definition Concepts.hpp:25
Checks if type T is same as any of the provided types in U.
Definition Concepts.hpp:48
T is_same_v
Definition Add.hpp:11
ExpressionType
The type of an expression.
Definition Expression.hpp:16