limes
3.1.0
Composable Calculus Expressions for C++20
Loading...
Searching...
No Matches
concepts.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <concepts>
4
#include <span>
5
#include <cstddef>
6
7
namespace
limes::expr::concepts
{
8
9
// ExprNode concept: types that represent expression tree nodes
10
// Each node has a compile-time arity and can be evaluated with arguments
11
template
<
typename
E,
typename
T>
12
concept
ExprNode
=
requires
(E
const
& expr, std::span<T const> args) {
13
{ E::arity_v } -> std::convertible_to<std::size_t>;
14
{ expr.evaluate(args) } -> std::convertible_to<T>;
15
};
16
17
// DifferentiableNode: nodes that can compute their derivative with respect to a dimension
18
template
<
typename
E,
typename
T, std::
size_t
Dim>
19
concept
DifferentiableNode
=
ExprNode<E, T>
&&
requires
(E
const
& expr) {
20
{ expr.template derivative<Dim>() };
21
};
22
23
// StringableNode: nodes that can produce a string representation
24
template
<
typename
E>
25
concept
StringableNode
=
requires
(E
const
& expr) {
26
{ expr.to_string() } -> std::convertible_to<std::string>;
27
};
28
29
}
// namespace limes::expr::concepts
limes::expr::concepts::DifferentiableNode
Definition
concepts.hpp:19
limes::expr::concepts::ExprNode
Definition
concepts.hpp:12
limes::expr::concepts::StringableNode
Definition
concepts.hpp:25
limes::expr::concepts
Definition
concepts.hpp:7
include
limes
expr
concepts.hpp
Generated on Fri Jan 30 2026 11:36:49 for limes by
1.9.8