diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e636b132..2eb8547d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,9 @@ find_package(spdlog CONFIG REQUIRED) # https://github.com/intel/tbb find_package(TBB CONFIG REQUIRED) +# https://github.com/TartanLlama/expected +find_package(tl-expected CONFIG REQUIRED) + # https://github.com/TartanLlama/function_ref find_package(tl-function-ref CONFIG REQUIRED) diff --git a/include/Apply_move.hpp b/include/Apply_move.hpp index 51918484d..743fc473e 100644 --- a/include/Apply_move.hpp +++ b/include/Apply_move.hpp @@ -13,9 +13,9 @@ #include -#include #include #include +#include #include /// @brief An applicative function similar to std::apply, but on manifolds @@ -28,7 +28,7 @@ /// @see https://tl.tartanllama.xyz/en/latest/api/function_ref.html /// @see https://tl.tartanllama.xyz/en/latest/api/expected.html template , + typename ExpectedType = tl::expected, typename FunctionType = tl::function_ref> auto constexpr apply_move(ManifoldType&& t_manifold, FunctionType t_move) noexcept -> decltype(auto) diff --git a/include/Ergodic_moves_3.hpp b/include/Ergodic_moves_3.hpp index 3c650e825..340a0780f 100644 --- a/include/Ergodic_moves_3.hpp +++ b/include/Ergodic_moves_3.hpp @@ -14,7 +14,7 @@ #ifndef CDT_PLUSPLUS_ERGODIC_MOVES_3_HPP #define CDT_PLUSPLUS_ERGODIC_MOVES_3_HPP -#include +#include #include "Manifold.hpp" #include "Move_tracker.hpp" @@ -22,7 +22,7 @@ namespace ergodic_moves { using Manifold = manifolds::Manifold_3; - using Expected = std::expected; + using Expected = tl::expected; using Cell_handle = Cell_handle_t<3>; using Cell_container = std::vector; using Edge_handle = Edge_handle_t<3>; @@ -101,7 +101,7 @@ namespace ergodic_moves // We've run out of (2,2) cells std::string const msg = "No (2,3) move possible.\n"; spdlog::warn(msg); - return std::unexpected(msg); + return tl::unexpected(msg); } /// @brief Perform a TriangulationDataStructure_3::flip on an edge @@ -143,7 +143,7 @@ namespace ergodic_moves // We've run out of edges to try std::string const msg = "No (3,2) move possible.\n"; spdlog::warn(msg); - return std::unexpected(msg); + return tl::unexpected(msg); } // do_32_move() /// @brief Find a (2,6) move location @@ -211,7 +211,7 @@ namespace ergodic_moves #ifndef NDEBUG spdlog::trace(msg); #endif - return std::unexpected(msg); + return tl::unexpected(msg); } // Get indices of vertices of common face with respect to bottom cell @@ -236,7 +236,7 @@ namespace ergodic_moves #ifndef NDEBUG spdlog::trace(msg); #endif - return std::unexpected(msg); + return tl::unexpected(msg); } // Do the (2,6) move @@ -257,7 +257,7 @@ namespace ergodic_moves #ifndef NDEBUG spdlog::trace(msg); #endif - return std::unexpected(msg); + return tl::unexpected(msg); } // Each incident cell should be combinatorially and geometrically valid @@ -275,7 +275,7 @@ namespace ergodic_moves #ifndef NDEBUG spdlog::trace(msg); #endif - return std::unexpected(msg); + return tl::unexpected(msg); } // Now assign a geometric point to the center vertex @@ -311,7 +311,7 @@ namespace ergodic_moves #ifndef NDEBUG spdlog::trace(msg); #endif - return std::unexpected(msg); + return tl::unexpected(msg); } return t_manifold; @@ -324,7 +324,7 @@ namespace ergodic_moves // We've run out of (1,3) simplices to try std::string const msg = "No (2,6) move possible.\n"; spdlog::warn(msg); - return std::unexpected(msg); + return tl::unexpected(msg); } // do_26_move() /// @brief Find a (6,2) move location @@ -478,7 +478,7 @@ namespace ergodic_moves // We've run out of vertices to try std::string const msg = "No (6,2) move possible.\n"; spdlog::warn(msg); - return std::unexpected(msg); + return tl::unexpected(msg); } // do_62_move() /// @brief Find all cells incident to the edge @@ -834,7 +834,7 @@ namespace ergodic_moves // We've run out of edges to try std::string const msg = "No (4,4) move possible.\n"; spdlog::warn(msg); - return std::unexpected(msg); + return tl::unexpected(msg); } // do_44_move() /// @brief Check move correctness diff --git a/include/Move_command.hpp b/include/Move_command.hpp index 7efcf7f53..81b631b94 100644 --- a/include/Move_command.hpp +++ b/include/Move_command.hpp @@ -15,7 +15,7 @@ #include "Ergodic_moves_3.hpp" template , + typename ExpectedType = tl::expected, typename FunctionType = tl::function_ref> class MoveCommand { diff --git a/tests/Function_ref_test.cpp b/tests/Function_ref_test.cpp index 16b620ef0..5fb8af686 100644 --- a/tests/Function_ref_test.cpp +++ b/tests/Function_ref_test.cpp @@ -87,7 +87,7 @@ SCENARIO("Function_ref operations" * doctest::test_suite("function_ref")) auto constexpr desired_timeslices = 4; Manifold_3 manifold(desired_simplices, desired_timeslices); REQUIRE(manifold.is_correct()); - tl::function_ref(Manifold_3&)> const + tl::function_ref(Manifold_3&)> const complex_ref(ergodic_moves::do_23_move); WHEN("The function_ref is invoked.") { diff --git a/vcpkg.json b/vcpkg.json index 3043d2eed..06029b2bf 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -11,6 +11,7 @@ "pcg", "spdlog", "tbb", + "tl-expected", "tl-function-ref", { "name": "yasm-tool",