Context
In PR #712, World::clear() needs to reset m_bare_segment_indices (a SimpleCollector<size_t>). Since SimpleCollector does not provide a clear() method, the current workaround is to reassign a default-constructed instance:
// TODO: SimpleCollector should have a `clear()` method.
m_bare_segment_indices = SimpleCollector<size_t>();
See: #712 (comment)
Proposal
Add a clear() method to SimpleCollector (in cpp/modmesh/buffer/SimpleCollector.hpp) that resets its internal state (size back to 0, and optionally releases or reuses allocated memory).
This would allow callers to write m_bare_segment_indices.clear() instead of reassigning a new object.
Context
In PR #712,
World::clear()needs to resetm_bare_segment_indices(aSimpleCollector<size_t>). SinceSimpleCollectordoes not provide aclear()method, the current workaround is to reassign a default-constructed instance:See: #712 (comment)
Proposal
Add a
clear()method toSimpleCollector(incpp/modmesh/buffer/SimpleCollector.hpp) that resets its internal state (size back to 0, and optionally releases or reuses allocated memory).This would allow callers to write
m_bare_segment_indices.clear()instead of reassigning a new object.