Skip to content

Commit

Permalink
Fix iterating items of const library
Browse files Browse the repository at this point in the history
  • Loading branch information
Zylann committed Jun 9, 2024
1 parent f266d0c commit fd340cf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions terrain/instancing/voxel_instance_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ class VoxelInstanceLibrary : public Resource, public IInstanceLibraryItemListene
}
}

template <typename F>
void for_each_item(F f) const {
for (auto it = _items.begin(); it != _items.end(); ++it) {
ZN_ASSERT(it->second.is_valid());
f(it->first, **it->second);
}
}

void add_listener(IInstanceLibraryItemListener *listener);
void remove_listener(IInstanceLibraryItemListener *listener);

Expand Down

0 comments on commit fd340cf

Please sign in to comment.