|
13 | 13 |
|
14 | 14 | #include <spdlog/spdlog.h>
|
15 | 15 |
|
| 16 | +#include <expected> |
16 | 17 | #include <string>
|
17 |
| -#include <tl/expected.hpp> |
18 | 18 | #include <tl/function_ref.hpp>
|
19 | 19 |
|
20 |
| -/// @brief An applicative function similar to std::apply, but on manifolds |
21 |
| -/// @tparam ManifoldType The type (topology, dimensionality) of manifold |
22 |
| -/// @tparam ExpectedType The result of the move on the manifold |
23 |
| -/// @tparam FunctionType The type of move applied to the manifold |
24 |
| -/// @param t_manifold The manifold on which to make the Pachner move |
25 |
| -/// @param t_move The Pachner move |
26 |
| -/// @returns The expected or unexpected result in a tl::expected<T,E> |
27 |
| -/// @see https://tl.tartanllama.xyz/en/latest/api/function_ref.html |
28 |
| -/// @see https://tl.tartanllama.xyz/en/latest/api/expected.html |
| 20 | +/** |
| 21 | + * \brief An applicative function similar to std::apply on a manifold |
| 22 | + * \tparam ManifoldType The type (topology, dimensionality) of manifold |
| 23 | + * \tparam ExpectedType The result type of the move on the manifold |
| 24 | + * \tparam FunctionType The type of move applied to the manifold |
| 25 | + * \param t_manifold The manifold on which to make the Pachner move |
| 26 | + * \param t_move The Pachner move |
| 27 | + * \return The expected or unexpected result in a std::expected<T,E> |
| 28 | + */ |
29 | 29 | template <typename ManifoldType,
|
30 |
| - typename ExpectedType = tl::expected<ManifoldType, std::string>, |
| 30 | + typename ExpectedType = std::expected<ManifoldType, std::string>, |
31 | 31 | typename FunctionType = tl::function_ref<ExpectedType(ManifoldType&)>>
|
32 | 32 | auto constexpr apply_move(ManifoldType&& t_manifold,
|
33 | 33 | FunctionType t_move) noexcept -> decltype(auto)
|
34 | 34 | {
|
35 | 35 | if (auto result = std::invoke(t_move, std::forward<ManifoldType>(t_manifold));
|
36 |
| - result) |
| 36 | + result.has_value()) |
37 | 37 | {
|
38 | 38 | return result;
|
39 | 39 | }
|
|
0 commit comments