Sleipnir C++ API
Loading...
Searching...
No Matches
concepts.hpp
1
// Copyright (c) Sleipnir contributors
2
3
#pragma once
4
5
#include <concepts>
6
#include <type_traits>
7
8
#include <Eigen/Core>
9
10
namespace
slp {
11
12
template
<
typename
T>
13
concept
ScalarLike
=
requires
(std::decay_t<T> t) {
14
t + 1.0;
15
t = 1.0;
16
};
17
18
template
<
typename
T>
19
concept
EigenMatrixLike
=
20
std::derived_from<std::decay_t<T>, Eigen::MatrixBase<std::decay_t<T>>>;
21
22
template
<
typename
T>
23
concept
SleipnirMatrixLike
=
requires
(T t,
int
rows,
int
cols) {
24
t.rows();
25
t.cols();
26
} && !
EigenMatrixLike<T>
;
27
28
template
<
typename
T>
29
concept
MatrixLike
=
SleipnirMatrixLike<T>
||
EigenMatrixLike<T>
;
30
31
}
// namespace slp
slp::EigenMatrixLike
Definition
concepts.hpp:19
slp::MatrixLike
Definition
concepts.hpp:29
slp::ScalarLike
Definition
concepts.hpp:13
slp::SleipnirMatrixLike
Definition
concepts.hpp:23
include
sleipnir
util
concepts.hpp
Generated on Fri Mar 14 2025 19:37:46 for Sleipnir C++ API by
1.9.8