Skip to content

Commit

Permalink
giving up on string_view for now
Browse files Browse the repository at this point in the history
  • Loading branch information
mtao committed Nov 15, 2024
1 parent 19f4428 commit b63a823
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct NamedMultiMesh::Node
std::string name;
std::vector<std::unique_ptr<Node>> m_children;

std::map<std::string_view, int64_t> m_child_indexer;
std::map<std::string, int64_t> m_child_indexer;
void set_names(const nlohmann::json& js)
{
if (js.is_null()) {
Expand Down Expand Up @@ -135,7 +135,7 @@ bool NamedMultiMesh::has_mesh(const std::string_view& path) const
Node const* cur_mesh = m_name_root.get();
assert(*split.begin() == cur_mesh->name || *split.begin() == "");

Check warning on line 136 in components/multimesh/src/wmtk/components/multimesh/NamedMultiMesh.cpp

View check run for this annotation

Codecov / codecov/patch

components/multimesh/src/wmtk/components/multimesh/NamedMultiMesh.cpp#L135-L136

Added lines #L135 - L136 were not covered by tests
for (const auto& token : std::ranges::views::drop(split, 1)) {
auto it = cur_mesh->m_child_indexer.find(token);
auto it = cur_mesh->m_child_indexer.find(std::string(token));

Check warning on line 138 in components/multimesh/src/wmtk/components/multimesh/NamedMultiMesh.cpp

View check run for this annotation

Codecov / codecov/patch

components/multimesh/src/wmtk/components/multimesh/NamedMultiMesh.cpp#L138

Added line #L138 was not covered by tests
if (it == cur_mesh->m_child_indexer.end()) {
return false;

Check warning on line 140 in components/multimesh/src/wmtk/components/multimesh/NamedMultiMesh.cpp

View check run for this annotation

Codecov / codecov/patch

components/multimesh/src/wmtk/components/multimesh/NamedMultiMesh.cpp#L140

Added line #L140 was not covered by tests
} else {
Expand All @@ -157,7 +157,7 @@ auto NamedMultiMesh::get_id(const std::string_view& path) const -> std::vector<i
Node const* cur_mesh = m_name_root.get();
assert(*split.begin() == cur_mesh->name || *split.begin() == "");
for (const auto& token : std::ranges::views::drop(split, 1)) {
int64_t index = cur_mesh->m_child_indexer.at(token);
int64_t index = cur_mesh->m_child_indexer.at(std::string(token));
indices.emplace_back(index);
cur_mesh = cur_mesh->m_children[index].get();
}
Expand Down Expand Up @@ -284,6 +284,5 @@ void NamedMultiMesh::append_child_mesh_names(const Mesh& parent, const NamedMult
*cur_mesh->m_children[id] = *o.m_name_root;

Check warning on line 284 in components/multimesh/src/wmtk/components/multimesh/NamedMultiMesh.cpp

View check run for this annotation

Codecov / codecov/patch

components/multimesh/src/wmtk/components/multimesh/NamedMultiMesh.cpp#L284

Added line #L284 was not covered by tests
}
cur_mesh->update_child_names();

}
} // namespace wmtk::components::multimesh

0 comments on commit b63a823

Please sign in to comment.