WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
concepts.hpp
Go to the documentation of this file.
1// Copyright (c) Sleipnir contributors
2
3#pragma once
4
5#include <concepts>
6#include <type_traits>
7
8#include <Eigen/Core>
9
11
12namespace slp {
13
14template <typename T>
15concept SleipnirType = std::derived_from<std::decay_t<T>, SleipnirBase>;
16
17template <typename T>
18concept MatrixLike = requires(std::decay_t<T> t) {
19 t.rows();
20 t.cols();
21};
22
23template <typename T>
24concept ScalarLike =
25 !MatrixLike<T> && std::constructible_from<std::decay_t<T>, int>;
26
27template <typename T>
29 std::derived_from<std::decay_t<T>, Eigen::MatrixBase<std::decay_t<T>>> &&
31
32template <typename T, typename Scalar>
35 std::same_as<typename std::decay_t<T>::Scalar, Scalar>;
36
37template <typename T, typename Scalar>
40 std::same_as<typename std::decay_t<T>::Scalar, Scalar>;
41
42} // namespace slp
Marker interface for concepts to determine whether a given scalar or matrix type belongs to Sleipnir.
Definition sleipnir_base.hpp:9
Definition concepts.hpp:28
Definition concepts.hpp:18
Definition concepts.hpp:24
Definition concepts.hpp:33
Definition concepts.hpp:38
Definition concepts.hpp:15
Definition expression_graph.hpp:11