summaryrefslogtreecommitdiffhomepage
path: root/src/path-search-result.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-10-06 19:29:28 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-10-06 19:31:18 +0200
commit41f8fe4e55a3b0f2e471959374ba36314e19edc0 (patch)
tree362982ad2b05427121d24fc9cd99360603bc8796 /src/path-search-result.hpp
parent5fe82a0a598331ca7b1bb5eea0286c09c4718981 (diff)
a
Diffstat (limited to 'src/path-search-result.hpp')
-rw-r--r--src/path-search-result.hpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/path-search-result.hpp b/src/path-search-result.hpp
index 7e3f30a7..ea00cd85 100644
--- a/src/path-search-result.hpp
+++ b/src/path-search-result.hpp
@@ -1,5 +1,6 @@
#pragma once
#include "src/global-coords.hpp"
+#include <memory>
#include <vector>
namespace floormat {
@@ -7,10 +8,7 @@ namespace floormat {
struct path_search_result final
{
friend class path_search;
-
- path_search_result();
- path_search_result(ArrayView<const global_coords> array);
- path_search_result(const path_search_result& other);
+ friend struct test_app;
const global_coords* data() const;
const global_coords& operator[](size_t index) const;
@@ -19,14 +17,33 @@ struct path_search_result final
explicit operator ArrayView<const global_coords>() const;
explicit operator bool() const;
- const global_coords* begin() const;
- const global_coords* end() const;
-
private:
+ fm_DECLARE_DEFAULT_MOVE_ASSIGNMENT_(path_search_result);
+ path_search_result(const path_search_result& x) noexcept;
+ path_search_result& operator=(const path_search_result& x) noexcept;
+
static constexpr size_t min_length = TILE_MAX_DIM*2;
- path_search_result* _next;
- std::vector<global_coords> _path;
+ struct node
+ {
+ friend struct path_search_result;
+
+ node() noexcept;
+ fm_DECLARE_DELETED_COPY_ASSIGNMENT(node);
+ fm_DECLARE_DEFAULT_MOVE_ASSIGNMENT_(node);
+
+ std::vector<global_coords> vec;
+
+ private:
+ std::unique_ptr<node> _next;
+ };
+
+ static std::unique_ptr<node> _pool; // NOLINT(*-avoid-non-const-global-variables)
+
+ path_search_result();
+ ~path_search_result() noexcept;
+
+ std::unique_ptr<node> _node;
};
} // namespace floormat