Skip to content

Commit

Permalink
Revert to C++20
Browse files Browse the repository at this point in the history
  • Loading branch information
acgetchell committed Oct 24, 2023
1 parent e138350 commit c7ce11d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions include/Apply_move.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

#include <spdlog/spdlog.h>

Check failure on line 14 in include/Apply_move.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/include/Apply_move.hpp:14:10 [clang-diagnostic-error]

'spdlog/spdlog.h' file not found

Check failure on line 14 in include/Apply_move.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/include/Apply_move.hpp:14:10 [clang-diagnostic-error]

'spdlog/spdlog.h' file not found

#include <expected>
#include <functional>
#include <string>
#include <tl/expected.hpp>
#include <tl/function_ref.hpp>

/// @brief An applicative function similar to std::apply, but on manifolds
Expand All @@ -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 ManifoldType,
typename ExpectedType = std::expected<ManifoldType, std::string>,
typename ExpectedType = tl::expected<ManifoldType, std::string>,
typename FunctionType = tl::function_ref<ExpectedType(ManifoldType&)>>
auto constexpr apply_move(ManifoldType&& t_manifold,
FunctionType t_move) noexcept -> decltype(auto)
Expand Down
24 changes: 12 additions & 12 deletions include/Ergodic_moves_3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
#ifndef CDT_PLUSPLUS_ERGODIC_MOVES_3_HPP
#define CDT_PLUSPLUS_ERGODIC_MOVES_3_HPP

#include <expected>
#include <tl/expected.hpp>

Check failure on line 17 in include/Ergodic_moves_3.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

/include/Ergodic_moves_3.hpp:17:10 [clang-diagnostic-error]

'tl/expected.hpp' file not found

#include "Manifold.hpp"
#include "Move_tracker.hpp"

namespace ergodic_moves
{
using Manifold = manifolds::Manifold_3;
using Expected = std::expected<Manifold, std::string>;
using Expected = tl::expected<Manifold, std::string>;
using Cell_handle = Cell_handle_t<3>;
using Cell_container = std::vector<Cell_handle>;
using Edge_handle = Edge_handle_t<3>;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -311,7 +311,7 @@ namespace ergodic_moves
#ifndef NDEBUG
spdlog::trace(msg);
#endif
return std::unexpected(msg);
return tl::unexpected(msg);
}

return t_manifold;
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/Move_command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "Ergodic_moves_3.hpp"

template <typename ManifoldType,
typename ExpectedType = std::expected<ManifoldType, std::string>,
typename ExpectedType = tl::expected<ManifoldType, std::string>,
typename FunctionType = tl::function_ref<ExpectedType(ManifoldType&)>>
class MoveCommand
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Function_ref_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::expected<Manifold_3, std::string>(Manifold_3&)> const
tl::function_ref<tl::expected<Manifold_3, std::string>(Manifold_3&)> const
complex_ref(ergodic_moves::do_23_move);
WHEN("The function_ref is invoked.")
{
Expand Down
1 change: 1 addition & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"pcg",
"spdlog",
"tbb",
"tl-expected",
"tl-function-ref",
{
"name": "yasm-tool",
Expand Down

0 comments on commit c7ce11d

Please sign in to comment.