changed to string view

This commit is contained in:
2026-03-11 14:31:45 +03:00
parent 6081a9c426
commit ffacba71e2
2 changed files with 3 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ namespace omath::pathfinding
bool empty() const; bool empty() const;
// Events -- per-vertex optional tag (e.g. "jump", "teleport") // Events -- per-vertex optional tag (e.g. "jump", "teleport")
void set_event(const Vector3<float>& vertex, std::string event_id); void set_event(const Vector3<float>& vertex, const std::string_view& event_id);
void clear_event(const Vector3<float>& vertex); void clear_event(const Vector3<float>& vertex);
[[nodiscard]] [[nodiscard]]

View File

@@ -30,12 +30,12 @@ namespace omath::pathfinding
return m_vertex_map.empty(); return m_vertex_map.empty();
} }
void NavigationMesh::set_event(const Vector3<float>& vertex, std::string event_id) void NavigationMesh::set_event(const Vector3<float>& vertex, const std::string_view& event_id)
{ {
if (!m_vertex_map.contains(vertex)) if (!m_vertex_map.contains(vertex))
throw std::invalid_argument(std::format("Vertex '{}' not found", vertex)); throw std::invalid_argument(std::format("Vertex '{}' not found", vertex));
m_vertex_events[vertex] = std::move(event_id); m_vertex_events[vertex] = event_id;
} }
void NavigationMesh::clear_event(const Vector3<float>& vertex) void NavigationMesh::clear_event(const Vector3<float>& vertex)